Bug Tracker

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#14142 closed bug (fixed)

Wrong number of elements returned in XML document with numeric IDs in Safari

Reported by: vibes@… Owned by: gibson042
Priority: low Milestone: 1.11/2.1
Component: selector Version: 1.10.2
Keywords: Cc:
Blocked by: Blocking:


In a very special case find returns the wrong number of elements when used on an XML document with elements that have numeric ids. The exact conditions for this bug to occur are:

  • Safari only
  • The selector used is of the form "parent children"
  • One of the children has an id attribute with the value corresponding to the number of children

For a detailed example see: http://jsfiddle.net/fHs96/10/

The same bug probably also occurs on HTML documents (HTML5 allows numeric ids).

Change History (8)

comment:1 Changed 3 years ago by gibson042

  • Owner set to gibson042
  • Status changed from new to assigned

You've certainly hit an interesting corner case... we use an unusual iteration pattern because <NodeList>.length is unreliable on Internet Explorer (allowing elements with id "length" to mask the numeric property), but this shows that <NodeList>[<index>] is similarly unreliable on Safari.

comment:3 Changed 3 years ago by vibes@…

Nice, thanks for the quick fix!

comment:4 Changed 3 years ago by Timmy Willison

  • Resolution set to fixed
  • Status changed from assigned to closed

Update Sizzle to 1.10.5. Fixes #14142.

Changeset: 0600a29256be76bd87adb547545bf7219fafb6ee

comment:5 Changed 3 years ago by gibson042

#14141 is a duplicate of this ticket.

comment:6 Changed 3 years ago by dmethvin

  • Milestone changed from None to 1.11/2.1

comment:7 Changed 3 years ago by dmethvin

  • Component changed from unfiled to selector
  • Priority changed from undecided to low

comment:8 Changed 3 years ago by gibson042

#13058 is a duplicate of this ticket.

Note: See TracTickets for help on using tickets.