Skip to main content

Bug Tracker

Side navigation

#4274 closed bug (invalid)

Opened March 01, 2009 06:11PM UTC

Closed March 01, 2009 10:06PM UTC

jQuery.index() is +1 for document.body elements in IE 7

Reported by: dandoyon Owned by:
Priority: major Milestone: 1.4
Component: core Version: 1.3.1
Keywords: jQuery.index() inconsistent I/E 7 Cc:
Blocked by: Blocking:

Was playing around for first time with index and found anomaly with IE 7. Doesn't happen on Mozilla/Chrome/Safari. It looks like IE is adding an element to DOM before the document.body.

The indices for dom elements in I/E 7

<html> = 0

<head> = 1

<body> = 3

Attachments (1)
Change History (2)

Changed March 01, 2009 06:23PM UTC by dandoyon comment:1

I did some more research and updated my sample html, turns out IE is adding a <TITLE> when none exists.

Changed March 01, 2009 10:06PM UTC by dmethvin comment:2

resolution: → invalid
status: newclosed


element is required for most doctypes, so IE is probably adding an empty one in an attempt to to turn an invalid document into a valid one.

Also, since the document uses self-closing tags this must be some variation of XHTML, but there is no doctype so IE is parsing it in quirks mode.