Skip to main content

Bug Tracker

Side navigation

#5336 closed bug (invalid)

Opened October 08, 2009 07:52AM UTC

Closed October 08, 2009 11:03PM UTC

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;

Attachments (0)
Change History (1)

Changed October 08, 2009 11:03PM UTC by dmethvin comment:1

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.