Bug Tracker

Opened 14 years ago

Closed 13 years ago

#4203 closed bug (fixed)

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:


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)

jquery-color-test.zip (667 bytes) - added by jq_johan 14 years ago.

Download all attachments as: .zip

Change History (4)

Changed 14 years ago by jq_johan

Attachment: jquery-color-test.zip added

comment:1 Changed 14 years ago by Calamari

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

comment:2 Changed 14 years ago by jq_johan

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.

comment:3 Changed 13 years ago by dmethvin

Resolution: fixed
Status: newclosed

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

Note: See TracTickets for help on using tickets.