Bug Tracker

Opened 10 years ago

Closed 10 years ago

#4274 closed bug (invalid)

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:

Description

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)

jqueryIndexIE7.html (779 bytes) - added by dandoyon 10 years ago.

Download all attachments as: .zip

Change History (3)

Changed 10 years ago by dandoyon

Attachment: jqueryIndexIE7.html added

comment:1 Changed 10 years ago by dandoyon

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

comment:2 Changed 10 years ago by dmethvin

Resolution: invalid
Status: newclosed

The <title> 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.

http://www.w3.org/TR/REC-html40/struct/global.html#h-7.4.2

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.

Note: See TracTickets for help on using tickets.