Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Mask created in second Snap SVG is added to defs of first one #207

Closed
Fyrd opened this Issue · 3 comments

4 participants

Alexis Deveria Florian Brückner Tom Kiss Dmitry Baranovskiy
Alexis Deveria
Owner

This looks similar to #103 but the fix there doesn't solve this bug.

Codepen demo:
http://codepen.io/anon/pen/ztnwE

Running the demo alerts the amount of masks in each SVG element, which should be 1 each.

Florian Brückner

I'm experiencing the same erratic behaviour:
I have about 30 DOM elements with an SVG node each, looping through them to create unique masks for each of them and even though I create the paths in the same scope as I apply them to the objects masked, the nodes are only to be found under the the very first node.

Is there a way of referencing a node in the HTML document so I can create the mask nodes manually?

Thanks in advance.

Tom Kiss

+1 also experiencing this same issue.

Have tried to workaround with regular JS but failed. Bugs like this are deal breakers, now considering switching to svg.js, as this bug is already pretty old and there's no guarantee of a fix anytime soon - are Adobe actually supporting snap.svg?

I noticed that removing the cache on line 2026 from the getSomeDefs function prevents this issue (but presumably adds more overhead for the processing):

function getSomeDefs(el) {
    var cache = Snap._.someDefs;
    // if (cache && contains(cache.ownerDocument.documentElement, cache)) {
    //     return cache;
    // }
Tom Kiss

Amazing, thanks Dmitry!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.