#10791 closed bug (wontfix)
Delegated Events fail on SVG elements
Reported by: | rodneyrehm | Owned by: | gibson042 |
---|---|---|---|
Priority: | low | Milestone: | |
Component: | event | Version: | 1.7 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Using delegated events on embedded SVG has an error regarding class selectors (possibly other selectors, too). This used to work with jQuery 1.6.4.
http://jsfiddle.net/rodneyrehm/ydmXA/ - working jQuery 1.6.4 http://jsfiddle.net/rodneyrehm/cm9Gv/ - failing jQuery 1.7
Change History (9)
comment:1 Changed 12 years ago by
Component: | unfiled → event |
---|---|
Milestone: | None → 1.7.1 |
Owner: | set to dmethvin |
Priority: | undecided → low |
Status: | new → assigned |
comment:2 Changed 12 years ago by
To continue timmywil's line of thought:
http://jsfiddle.net/dmethvin/mzjEY/
el.attributes['class'].value
seems to work all the way back to IE6; you'll need to comment out a few lines for it to run in IE6/7.
Unfortunately we probably need to check el.attributes && el.attributes['class'] && el.attributes['class'].value
to be safe.
Did I mention I hate SVG?
comment:3 Changed 12 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Fix #10791. SVG clamors for special treatment of its class names.
Changeset: 780c59b89d3b7fb9bcc480aa3173693a9d633853
comment:4 Changed 11 years ago by
Milestone: | 1.7.1 |
---|---|
Resolution: | fixed |
Status: | closed → reopened |
comment:5 Changed 11 years ago by
Owner: | changed from dmethvin to gibson042 |
---|---|
Status: | reopened → assigned |
https://github.com/jquery/jquery/pull/857
Please use "[class~='foo']" with SVG elements
Edit: corrected selector
comment:6 Changed 11 years ago by
Resolution: | → wontfix |
---|---|
Status: | assigned → closed |
For the browsers where .foo
wouldn't work, [class~=foo]
should work.
comment:8 follow-up: 9 Changed 10 years ago by
just for those wondering like I did, jQuery don't plan on fixing any issue related to SVG/XML/VML: http://docs.jquery.com/Won%27t_Fix#SVG.2FXML.2FVML_Bugs
and the workaround ~= might be problematic is some cases ([class~='selected'] also matches class="unselected")
comment:9 Changed 10 years ago by
Replying to BiAiB:
the workaround ~= might be problematic is some cases ([class~='selected'] also matches class="unselected")
No, ~=
treats attribute values as space-separated lists and checks for an exact match.
http://www.w3.org/TR/CSS21/selector.html#pattern-matching
http://api.jquery.com/attribute-contains-word-selector
http://jsfiddle.net/cm9Gv/5/
Possible solution for quickIs:
We'll look into it.