Bug Tracker

Modify

Ticket #5418 (closed bug: fixed)

Opened 4 years ago

Last modified 16 months ago

this[0].ownerDocument is null in IE6

Reported by: jmaki Owned by: brandon
Priority: minor Milestone: 1.3.2
Component: offset Version: 1.3.2
Keywords: ie6 Cc:
Blocking: Blocked by:

Description

In IE6, jQuery throws on error when attempting to calculate the body offset in jQuery.fn.offset. On line 4175, the browser attempts to access the "body" property of this[0].ownerDocument, but this[0].ownerDocument.body is null.

I *think* the correct behavior can be achieved by changing the line above to:

if ( !this[0]
!this[0].ownerDocument ) return { top: 0, left: 0 };

Change History

comment:1 Changed 4 years ago by jmaki

Argh; sorry, the code got messed up. It should be:

 if ( !this[0] || !this[0].ownerDocument ) return { top: 0, left: 0 };

comment:2 Changed 4 years ago by dmethvin

  • Keywords ie6 added
  • need changed from Review to Test Case
  • Component changed from unfilled to offset
  • Owner set to brandon

That will get rid of the error, for sure, but under what circumstances does this error occur? Can you provide a test case?

comment:3 Changed 3 years ago by dmethvin

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

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.