W3C home > Mailing lists > Public > www-dom@w3.org > April to June 2009

styleSheets array - link vs @import

From: David Perrell <davidp@hpaa.com>
Date: Thu, 25 Jun 2009 15:33:14 -0700
To: <www-dom@w3.org>
Message-ID: <HIEDLECHAFDEPLGKECDDMEHMALAB.davidp@hpaa.com>
Hello.

With this markup:

  <link href="/css/mystyle.css" rel="stylesheet" type="text/css">
  <style type="text/css">
    [some style rules]
  </style>

followed by this script:

  <script type="text/javascript">
  alert('length=='+document.styleSheets.length);
  ...

the alert gives length==2 in MSIE, Firefox and Opera, while in Google Chrome
it gives length==1;

Change the linked stylesheet to imported stylesheet, e.g.:

  <style type="text/css">
    @import url(/css/mystyle.css);
  </style>
  <style type="text/css">
    [some style rules]
  </style>

and Google Chrome gives length==2;

Clearly, Google Chrome is not creating an index in the styleSheets array for
a stylesheet loaded via a LINK until that stylesheet is completely loaded.

Is *correct* behavior specified anywhere?

David P
Received on Thursday, 25 June 2009 22:34:17 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:14:00 GMT