Closed Bug 1079486 Opened 10 years ago Closed 10 years ago

CSS attribute not available in JS in hidden IFrame

Categories

(Core :: CSS Parsing and Computation, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 548397

People

(Reporter: mike.skalnik, Unassigned)

References

Details

(Keywords: compat, Whiteboard: [parity-webkit][parity-blink])

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.101 Safari/537.36

Steps to reproduce:

In a hidden iframe, the computed style is not available, which is required in some cases. You can see this gist as an example: https://gist.github.com/skalnik/2f69478b435502357c81 When looking at `iframe.html` directly, you can see an output of "600px". When looking at it through `index.html`, you get an error.


Actual results:

`style` is undefined.


Expected results:

`style` should be defined.
In both Safari & Chrome the CSS styles are available, so the console.log output of "600px" comes through in `index.html`.
This seems to be related to bug 684197.  From bz's comment there:

> We don't perform layout in display:none iframes, because there is no sane
> way to do it: a display:none iframe has no dimensions, but the sizes of
> things inside it depend on the dimensions of the iframe.
Depends on: 684197
OS: Mac OS X → All
Hardware: x86 → All
Version: 32 Branch → Trunk
See also bug 1011330 comment 3 for a possible solution ("we could just treat display:none as sized 0x0").
Keywords: compat
Whiteboard: [parity-webkit][parity-blink]
> We don't perform layout in display:none iframes, because there is no sane
> way to do it: a display:none iframe has no dimensions, but the sizes of
> things inside it depend on the dimensions of the iframe.

That makes some sense, but I figured CSS attributes that aren't effected by the dimensions should still be computed, like in my example with `max-width`.
Styles depend on media queries, which depend on the dimensions.

The right thing to do long-term is probably to treat those as 0x0, I guess.  Insofar as there is any "right" behavior in a case like that: the computed styles will be different once the iframe is shown.
Status: UNCONFIRMED → RESOLVED
Closed: 10 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.