premasagar / pablo

Pablo is a lightweight, expressive JavaScript SVG library. Pablo creates interactive drawings with SVG (Scalable Vector Graphics), giving access to all of SVG's granularity and power.
https://pablojs.com
MIT License
413 stars 16 forks source link

PabloCollection.parentsSvg() returns all parents regardless of if svg or not #53

Closed AaronAcerboni closed 11 years ago

AaronAcerboni commented 11 years ago

parentsSvg() should return the ancestors of an element which are only svg elements. The bug is that it returns all types.

var collection = Pablo('div', {}),
    deepChild;

collection.circle().ellipse().append('a');
deepChild = collection.find('a');

deepChild.parentsSvg();
// ^ Incorrect because its [ellipse, circle, div] when
//   it should be just [ellipse, circle]
premasagar commented 11 years ago

This is correct. The 'div' you create is an svg element. Currently, Pablo only creates elements with the svg namespace (even though 'div' isn't a standard svg element.

On Wednesday, March 20, 2013, AaronAcerboni wrote:

parentsSvg() should return the ancestors of an element which are only svg elements. The bug is that it returns all types.

var collection = Pablo('div', {}), deepChild; collection.circle().ellipse().append('a');deepChild = collection.find('a'); deepChild.parentsSvg();// ^ Incorrect is because its [ellipse, circle, div] when it should be [ellipse, circle]

— Reply to this email directly or view it on GitHubhttps://github.com/dharmafly/pablo/issues/53 .

Premasagar Rose, Dharmafly http://dharmafly.com dharmafly.com / 07941 192398 premasagar.com twitter.com/premasagar L4RP.com asyncjs.com

AaronAcerboni commented 11 years ago

I'll create a div using document.createElement

AaronAcerboni commented 11 years ago

Implemented in 8b89b58