W3C home > Mailing lists > Public > www-style@w3.org > August 2013

RE: [css-regions] Reworking getNamedFlows()

From: François REMY <francois.remy.dev@outlook.com>
Date: Thu, 1 Aug 2013 18:18:12 +0200
Message-ID: <DUB120-W45E74810116B30A2BDB508A5500@phx.gbl>
To: Catalin Grigoroscuta <cataling@adobe.com>, Mihnea-Vlad Ovidenie <mihnea@adobe.com>, Boris Zbarsky <bzbarsky@mit.edu>, "www-style@w3.org" <www-style@w3.org>
>>You may want to add listeners to a named flow before the page actually
>>finished loading, and there's no good way to know when all the
>>stylesheets have been downloaded and applied (you don't want to use the
>>"load" event because it waits on images).
>>
>>Also, you may just want to listen to events on a flow that do not exist
>>yet but you suspect some script or media query could make alive depending
>>on conditions you don't want to know about (you just want to know when
>>you should start acting on the flow).
>>
>
> This is one way to do it, for the case where you know the name of the
> named flow in advance.
>
> While this solves the theoretical problem, I don't know a real life use
> case where this would be needed.
> What would you do anyway with the NamedFlow object before the images are
> loaded and the layout completed?

Huh... maybe make sure that the website looks good even when the user is on 3G connection and that loading images takes a while? A good website does not rely on the images themselves to size the image exclusion areas, so there's no point waiting for them anyway. 

If the goal of the events is to make sure the regions are adjusted to fit content, you want to do so as soon as possible, even if you have to readjust later on.

By the way, a lot of W3C tests use a <script> at the end of the page to interact with a NamedFlow, and I expect developers to do the same kind of things. There's a non-zero chance that the css stylesheets will all have been downloaded by the time the script is executed on most dev platforms, because css files are small and internet connections fast, so that will seem to work on the developer machine. However, it will not when the site runs in 3G because the CSS could load after the page finished parsing, causing any code that relies on the existence of a flow created by the stylesheet to fail to register any event on it because getNamedFlows()["the-flow"] will return undefined. 

If the web platform had a 'StyleReady' event you could hook up, you could still tell people to wait for this event before attempting to use any NamedFlow but this event does not exist so developers only have choice between DOMContentReady and Load; the first one is fast but doesn't guarantee all stylesheets have been applied, the second can be inacceptably delayed but gives you that guarantee. 		 	   		  
Received on Thursday, 1 August 2013 16:18:39 UTC

This archive was generated by hypermail 2.3.1 : Thursday, 1 August 2013 16:18:40 UTC