Bug Tracker

Modify

Ticket #4203 (closed bug: fixed)

Opened 4 years ago

Last modified 3 years ago

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:
Blocking: Blocked by:

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

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

Change History

Changed 4 years ago by jq_johan

comment:1 Changed 4 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 4 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 3 years ago by dmethvin

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

There's no test case, but the internal code uses elem.ownerDocument.defaultView now so it should be 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.