- From: Boris Zbarsky <bzbarsky@MIT.EDU>
- Date: Tue, 07 Jan 2014 15:06:51 -0500
- To: Ian Hickson <ian@hixie.ch>
- Cc: whatwg <whatwg@lists.whatwg.org>, Yoav Weiss <yoav@yoav.ws>
On 1/7/14 2:24 PM, Ian Hickson wrote: > It's probably just a matter of saying, in the rendering section, that nested browsing contexts that > aren't _being_rendered_ (or that are <frame>s outside <frameset>s) get a > 0x0 viewport. That doesn't seem unreasonable. > (Viewports that are being rendered seem to have an > unambiguous dimension Actually, nothing defines this either. It should be the content box of the <iframe>, assuming iframes can't get fragmented. If they can be fragmented, I have no idea. > Right now, Chrome and Firefox seem to report 0 as the body.offsetWidth for > a hidden iframe. (Couldn't get a result for Safari; don't have IE here.) > > http://software.hixie.ch/utilities/js/live-dom-viewer/saved/2725 > For Chrome (since it puts data: in the wrong origin) > > http://software.hixie.ch/utilities/js/live-dom-viewer/saved/2726 > For Firefox (since for some reason the message in 2725 isn't sent?) > > Can you elaborate on the widly different things? What should I be testing? How about this testcase: <!DOCTYPE html> <style> div { color: purple; } </style> <link rel="stylesheet" href="data:text/css,%23one { color: yellow; }" media="(min-width: 300px)"> <link rel="stylesheet" href="data:text/css,%23two { color: yellow; }" media="(max-width: 300px)"> <div id="one"></div> <div id="two"></div> <script> window.onload = function() { alert(getComputedStyle(document.getElementById("one"), "").color + " | " + getComputedStyle(document.getElementById("two"), "").color); } </script> and variants on it. From my testing, in a display:none iframe: 1) Presto-based Opera treats the viewport width as 300px for purposes of the media queries and reports a document.body.offsetWidth of 0. 2) Blink and WebKit both seems to treat the viewport width as 0 when measured using either method. 3) Gecko doesn't allow creation of computed style objects in an iframe that's not being rendered and reports a document.body.offsetWidth of 0. 4) IE11 seems to do what Blink/WebKit do. -Boris
Received on Tuesday, 7 January 2014 20:07:28 UTC