Bug Tracker

Opened 12 years ago

Closed 11 years ago

Last modified 10 years ago

#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 Timmy Willison

Component: unfiledevent
Milestone: None1.7.1
Owner: set to dmethvin
Priority: undecidedlow
Status: newassigned

Possible solution for quickIs:

m[3].test( elem.attributes.class )

We'll look into it.

comment:2 Changed 12 years ago by dmethvin

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 Dave Methvin

Resolution: fixed
Status: assignedclosed

Fix #10791. SVG clamors for special treatment of its class names.

Changeset: 780c59b89d3b7fb9bcc480aa3173693a9d633853

comment:4 Changed 11 years ago by dmethvin

Milestone: 1.7.1
Resolution: fixed
Status: closedreopened

comment:5 Changed 11 years ago by gibson042

Owner: changed from dmethvin to gibson042
Status: reopenedassigned

https://github.com/jquery/jquery/pull/857

Please use "[class~='foo']" with SVG elements

Edit: corrected selector

Last edited 10 years ago by gibson042 (previous) (diff)

comment:6 Changed 11 years ago by dmethvin

Resolution: wontfix
Status: assignedclosed

For the browsers where .foo wouldn't work, [class~=foo] should work.

Last edited 10 years ago by gibson042 (previous) (diff)

comment:7 Changed 10 years ago by gibson042

#13015 is a duplicate of this ticket.

comment:8 Changed 10 years ago by BiAiB

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 in reply to:  8 Changed 10 years ago by gibson042

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/

Note: See TracTickets for help on using tickets.