On Thu, Aug 6, 2015 at 12:53 AM, Anne van Kesteren <ann...@annevk.nl> wrote: > On Tue, Aug 4, 2015 at 9:10 PM, James Burke <jbu...@mozilla.com> wrote: >> If the meta tag, or whatever the toggle becomes, is set, then I expect >> if the page's JS asks for a DOM element's box properties, it will get >> values like 0 for sizes, since I believe the goal is to avoid the >> browser doing extra work until the page's JS got everything set up. >> >> If that is the case, should there be a promise API for knowing when >> the first layout and rendering has occurred so that the page's JS can >> then ask for element box properties to get accurate values? > > That is an interesting point. We haven't really defined in standards > which features force layout. We'd have to do that so we can make them > behave conditionally as we try to provide some control over (first) > layout.
Lots of features force layout. Accessing any layout related properties like .offsetTop or .getComputedStyle() force a layout. Having an API which provides a callback when layout happens would be nice, but given how long that has been debated with little progress, we shouldn't block on that. A simple solution here would be to simply use MutationObservers to detect when the last <meta> is removed. Any time that layout properties are queried after that they could behave like they currently do, i.e. force a synchronous layout. If we want to we can provide syntax sugar which makes it easier to detect when the last <meta> is removed. But we should relate that to when the DOM mutation happens and not when screen rendering or layout happens. / Jonas _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform