Skip to main content

Bug Tracker

Side navigation

#4528 closed bug (wontfix)

Opened April 13, 2009 02:59PM UTC

Closed December 09, 2009 09:50PM UTC

parent > child selector doesn't work as expected if the child tag is an id that isn't unique

Reported by: piev Owned by: john
Priority: major Milestone: 1.4
Component: selector Version: 1.3.2
Keywords: parent, child, selector Cc:
Blocked by: Blocking:
Description

$('#id1 > #id2') does not return the existing object if its id ("id2") isn't unique.

Example:

<div id="test1">something goes here</div>

<div id="localHolding">

<div id="test1">Hello World</div>

<div id="test2">Hello Universe</div>

</div>

Then in the script section:

$('#localHolding > #test1').length=0;

Note: Previous versions (1.2.6) did handle this as expected.

Attachments (1)
  • jquery_bug.htm (1.1 KB) - added by piev April 13, 2009 03:00PM UTC.

    html file illustrating unexpected behaviour (bug)

Change History (2)

Changed December 07, 2009 07:36AM UTC by ajpiano comment:1

This ticket should be marked as invalid. The id attribute is required to be unique.

Changed December 09, 2009 09:50PM UTC by john comment:2

resolution: → wontfix
status: newclosed

This is going to have to be something that we'll punt on. In 1.2.6 #id1 > #id2 would fail if there were multiple #id1s, since in 1.3 we work right to left we just fail the other way around. We're going to have to pass on this, for performance reasons.