Bug Tracker

Opened 13 years ago

Closed 13 years ago

#5336 closed bug (invalid)

getComputedStyle() return value not checked when jQuery.fn.offset gets defined.

Reported by: NavahoGL Owned by: brandon
Priority: major Milestone: 1.4
Component: offset Version: 1.3.2
Keywords: Cc:
Blocked by: Blocking:


(I hope my description is clear enough.)

While messing around with Konqueror and Jquery 1.3.2 I discovered the following "bug".

The moment that jQuery.fn.offset is getting defined -- the following call is being made to defaultView.getComputedStyle():

4194: while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {

4195: computedStyle = defaultView.getComputedStyle(elem, null);

The getComputedStyle() call returns NULL in my case, and the script is not executed further.

The following seems a very obvious fix, although I am not sure this does not break things elsewhere.

4195: if(!(computedStyle = defaultView.getComputedStyle(elem, null)))

4196: continue;

Change History (1)

comment:1 Changed 13 years ago by dmethvin

Resolution: invalid
Status: newclosed

Is your element visible? The most common reason for getComputedStyle returning null is that the element is hidden. As the docs say, you can only get the offset of a visible element.


If your element is visible, please reopen this ticket with a test case that reproduces the problem.

Note: See TracTickets for help on using tickets.