Bug Tracker

Modify

Ticket #4274 (closed bug: invalid)

Opened 4 years ago

Last modified 4 years ago

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:
Blocking: Blocked by:

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

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

Change History

Changed 4 years ago by dandoyon

comment:1 Changed 4 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 4 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to invalid

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.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.