Skip to main content

Bug Tracker

Side navigation

#4203 closed bug (fixed)

Opened February 20, 2009 02:56PM UTC

Closed November 14, 2010 03:05PM UTC

firefox: color values on tags inside a frame are #00000 unless css is inline

Reported by: jq_johan Owned by:
Priority: major Milestone: 1.4
Component: core Version: 1.3.2
Keywords: Cc:
Blocked by: Blocking:
Description

I have a page with an iframe.

I am accessing some tags inside the frame but their color values are 0, on firefox.

$("iframe").contents().find("div"); getting the elements

.....

$(val).css("color"); getting their color values

.....

Attachments (1)
Change History (3)

Changed February 25, 2009 02:34AM UTC by Calamari comment:1

I cant sleep so I did some research on that issue (and fixed it). It seems that the first line of jQuery.curCSS function that is

''var style = elem.style;''

returns the style of an element that matches in the document context or no style at all. So far, so good. Now the function enteres the

''if ( defaultView.getComputedStyle )''

and begins doing its magic, and no there is the clue: defaultView was set to document.defaultView, so that's the crux of the matter.

Because I have no permission for uploading something to svn here is the change, that you have to do, in order to fix this bug:

there is a line

''defaultView = document.defaultView || {},''

can be deleted and in ''curCSS'' you need to add the following line to the var definitions:

''defaultView = elem.ownerDocument.defaultView;''

Should work now. Hopefully I could help then my sleeplessness wasn't in vain.

Cheers,

Georg Tavonius

Changed February 26, 2009 08:12AM UTC by jq_johan comment:2

Thanks a lot! It really works on firefox. Unfortunately IE6-7 don't like this fix (as usual :) ). However I think this was a good step towards fixing it completely.

Changed November 14, 2010 03:05PM UTC by dmethvin comment:3

resolution: → fixed
status: newclosed

There's no test case, but the internal code uses elem.ownerDocument.defaultView now so it should be fixed.