Aaron Gibralter
Aaron Gibralter

Reputation: 4853

jQuery events propagated from SVG elements in internet explorer

Is there a good way to get around IE7 producing "Error: Failed" when events are triggered on dynamically created SVG elements (such as those created by raphael.js)?

I think the "Error: Failed" are being produced when jQuery looks through my live handlers to check and see if the SVG element matches any of the live selectors I've specified... for now I manually bind functions that call

e.stopPropagation();

for every event (mouseenter, mouseleave, click, etc.) on my SVGs produced by raphael.

Upvotes: 1

Views: 816

Answers (2)

Edward Shtern
Edward Shtern

Reputation: 5477

I found that using Brandon Aaron's "livequery" plugin in place of jQuery's native "live" method for any live bindings to the "change" event solved this problem.

See:

hakoniemi

jQuery Bug

Upvotes: 0

Aaron Gibralter
Aaron Gibralter

Reputation: 4853

I couldn't find a good way to prevent this jQuery issue.

So what I ened up doing was capturing the events in Raphael.js and calling e.stopPropagation(); then I used IE's fireEvent to start the event again on the parent element of the VML/SVG element. A bit of a hack, but it works for now.

Upvotes: 1

Related Questions