Side navigation
#2847 closed bug (fixed)
Opened May 12, 2008 08:33PM UTC
Closed July 26, 2010 12:31AM UTC
Last modified March 14, 2012 04:19PM UTC
jQuery :first-child selector does not work in IE if comment precedes element
Reported by: | westonruter | Owned by: | john |
---|---|---|---|
Priority: | major | Milestone: | 1.4 |
Component: | selector | Version: | 1.3.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
In MEIE 6/7/8b1, the :first-child selector does not work if a comment is the first child; it does not work using either pure CSS nor using the jQuery selector engine. Both, however, work in Firefox and Safari.
Test case: http://weston.ruter.net/projects/test-cases/jquery-first-child-bug/
Attachments (2)
Change History (6)
Changed June 24, 2008 11:55AM UTC by comment:1
Changed August 14, 2008 08:07PM UTC by comment:2
I've done a much more in-depth test case and determined that this is the only one of the similar selectors that exhibits this bug. It appears that .getElementsByTagName("*") returns comment nodes in IE. I'm working on a patch.
Changed August 14, 2008 08:39PM UTC by comment:3
To fix this we're going to have to go slower and longer. A more clever patch might be better than the one I've just posted for review.
Changed November 30, 2009 06:25PM UTC by comment:4
component: | core → selector |
---|---|
owner: | → john |
Changed November 30, 2009 06:25PM UTC by comment:5
milestone: | 1.2.4 → 1.4 |
---|---|
version: | 1.2.3 → 1.3.2 |
Changed July 26, 2010 12:31AM UTC by comment:6
resolution: | → fixed |
---|---|
status: | new → closed |
This appears to have been fixed in 1.3.
The problem occurs because the first node returned for IE is the comment node. Here is my attempt at fixing it. (checked in IE6/7 and FF2/3).