Bug Tracker

Opened 14 years ago

Closed 13 years ago

#4917 closed bug (fixed)

IE 6/7/8 have bugs related to the Sizzle selector of child elements.

Reported by: jeffkretz Owned by: john
Priority: undecided Milestone: 1.4
Component: selector Version: 1.4a1
Keywords: Problems with children and > selector in IE6/7/8 Cc:
Blocked by: Blocking:


Unsurprisingly, these are browser-based bugs specific to IE. The other browsers do not have a problem.

See test case at http://test1.scorpiondesign.com/SelectorDemo.htm

There are 15 child items that should be found using both methods: div.children('div').children('a'); div.find('>div>a');

In IE6/7, the first method finds 14 items and the second finds only 1 item. Both values are incorrect.

In IE8, the first method finds 14 items and the second method finds 15 items.

I managed to track down the issue with > on IE6/7. It is related to the ">" relative selector which is testing elem.parentNode === part. For whatever reason, IE6/7 is returning true only on the first element. Subsequent elements return false. I test a temporary fix, using == rather than === (identity equals) which helps on that particular selector.

See second test case at http://test1.scorpiondesign.com/SelectorDemo2.htm

Now, IE 6/7/8 all return div.find('>div>a').length == 15;

But still return div.children('div').children('a').length == 14;

I stepped through that code and found that the jQuery.sibling function is returning false for the first item, but true for the rest. I was unable to come up with a simple workaround for this problem.

I will leave these pages up for your review.

Jeffrey Kretz

Change History (1)

comment:1 Changed 13 years ago by john

Resolution: fixed
Status: newclosed

It looks like this was resolved with the recent nodeName changes in Sizzle: http://github.com/jeresig/sizzle/commit/0e0177d990c72c00aa16ee8ca8bf96630d46726f

Note: See TracTickets for help on using tickets.