Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How do we find which are the pending style sheets ?

5 views
Skip to first unread message

biju

unread,
Apr 30, 2008, 11:42:52 PM4/30/08
to
There are situation where in JS code we need to know the height/width
CSS value set using linked/imported style sheet. If it takes some time
to load the style sheets, using JS code how do we find which are the
style sheets that have not completed loading/parsing?

PS: I think this is the reason for regression
https://bugzilla.mozilla.org/show_bug.cgi?id=404551#c6

Boris Zbarsky

unread,
May 1, 2008, 12:05:47 AM5/1/08
to
biju wrote:
> There are situation where in JS code we need to know the height/width
> CSS value set using linked/imported style sheet. If it takes some time
> to load the style sheets, using JS code how do we find which are the
> style sheets that have not completed loading/parsing?

If your JS code is linked in via a <script> element, then by the time that
<script> executes, all the stylesheets that had started loading before the
parser got to that <script> will be loaded.

The point of the change in bug 84582 was to not have sites try to answer that
question...

Now for the site in question
(http://extjs.com/deploy/dev/examples/desktop/desktop.html), the <link> for the
last stylesheet comes _after_ all the scripts. So it's possible for some events
(especially DOMContentLoaded) to execute before the stylesheet loads. I'm not
going to dig through those scripts right now, but that's my best guess for
what's going on: the site is running code that wants layout information from
DOMContentLoaded instead of onload...

-Boris

Bill Keese

unread,
May 1, 2008, 4:46:27 AM5/1/08
to
> If your JS code is linked in via a <script> element, then by the time that
> <script> executes, all the stylesheets that had started loading before the
> parser got to that <script> will be loaded.

OK follow up question... how about if the stylesheets themselves have
@import statements to recursively load other stylesheets?

Boris Zbarsky

unread,
May 1, 2008, 11:46:43 AM5/1/08
to
Bill Keese wrote:
> OK follow up question... how about if the stylesheets themselves have
> @import statements to recursively load other stylesheets?

A sheet is not considered to have loaded until all sheets it @imports have loaded.

-Boris

biju

unread,
May 2, 2008, 8:24:26 AM5/2/08
to
On May 1, 12:05 am, Boris Zbarsky <bzbar...@mit.edu> wrote:
Boris, Thanks for the reply...
0 new messages