<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>13977</bug_id>
          
          <creation_ts>2011-08-31 04:49:16 +0000</creation_ts>
          <short_desc>Check browsers; it might be that links with rel=stylesheet that aren&apos;t yet loaded should still have a sheet. See also https://bugs.webkit.org/show_bug.cgi?id=65140</short_desc>
          <delta_ts>2011-10-18 03:32:51 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>HTML WG</product>
          <component>HTML5 spec</component>
          <version>unspecified</version>
          <rep_platform>Other</rep_platform>
          <op_sys>other</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc>http://www.whatwg.org/specs/web-apps/current-work/#styling</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>contributor</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>annevk</cc>
    
    <cc>bzbarsky</cc>
    
    <cc>ian</cc>
    
    <cc>mike</cc>
    
    <cc>public-html-admin</cc>
    
    <cc>public-html-wg-issue-tracking</cc>
          
          <qa_contact name="HTML WG Bugzilla archive list">public-html-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>56079</commentid>
    <comment_count>0</comment_count>
    <who name="">contributor</who>
    <bug_when>2011-08-31 04:49:16 +0000</bug_when>
    <thetext>Specification: http://www.whatwg.org/specs/web-apps/current-work/complete.html
Multipage: http://www.whatwg.org/C#styling
Complete: http://www.whatwg.org/c#styling

Comment:
Check browsers; it might be that links with rel=stylesheet that aren&apos;t yet
loaded should still have a sheet. See also
https://bugs.webkit.org/show_bug.cgi?id=65140

Posted from: 208.54.39.147 by ian@hixie.ch
User agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_5_8) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.854.0 Safari/535.2</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>56081</commentid>
    <comment_count>1</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2011-08-31 05:29:15 +0000</bug_when>
    <thetext>Ian, if you need a description of Gecko&apos;s behavior here at some point, let me know.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>58314</commentid>
    <comment_count>2</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-10-18 00:32:38 +0000</bug_when>
    <thetext>As far as I can tell:

In IE, &lt;link&gt; loading blocks parsing before the element is added to the DOM.

In Gecko, &lt;link&gt; loading blocks parsing. For rel=stylesheet, a .sheet object is created as soon as the element is created. For other links, e.g. rel=&quot;alternate stylesheet&quot; or rel=nothing, .sheet is null.

In WebKit, .sheet is null until the sheet is loaded.

I couldn&apos;t work out what Opera was doing.

I think Gecko&apos;s idea makes sense and solves the problems raised around this, but why not have a sheet for rel=&quot;alternate stylesheet&quot;? (bz?)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>58315</commentid>
    <comment_count>3</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-10-18 00:32:56 +0000</bug_when>
    <thetext>btw, demo at: http://www.hixie.ch/tests/adhoc/dom/css/StyleSheet/002.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>58316</commentid>
    <comment_count>4</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-10-18 00:39:02 +0000</bug_when>
    <thetext>Apparently Opera&apos;s just blocking on the .sheet access. That would solve the problem too, but blocking on script execution is something vendors have asked me to avoid.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>58317</commentid>
    <comment_count>5</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2011-10-18 02:32:05 +0000</bug_when>
    <thetext>(In reply to comment #2)
&gt; In Gecko, &lt;link&gt; loading blocks parsing.

No, it does not.

It blocks execution of &lt;script&gt; elements, however.

&gt; For rel=stylesheet, a .sheet object is
&gt; created as soon as the element is created.

That&apos;s correct.

&gt; For other links, e.g. rel=&quot;alternate stylesheet&quot; or rel=nothing, .sheet is
&gt; null.

&quot;alternate stylesheet&quot; (or indeed any rel value containing &quot;stylesheet&quot; of type=&quot;text/css&quot; or no type set) should behave just like rel=&quot;stylesheet&quot; in Gecko.  What testcase did you use to determine the above?

Gecko&apos;s behavior is basically like this:  Insertion of a &lt;link&gt; (if it&apos;s determined to be a CSS stylesheet link via @rel and @type) or &lt;style&gt; element in the DOM immediately creates the .sheet and puts it in the right place in document.styleSheets.  Similar for a mutation to @rel or @type that makes a previously-not-CSS link into a CSS link.

&gt; In WebKit, .sheet is null until the sheet is loaded.

How is &quot;loaded&quot; defined?  If the sheet has @import rules, do those need to be loaded too?  (Think esp. for &lt;style&gt;.)

&gt; I think Gecko&apos;s idea makes sense and solves the problems raised around this,
&gt; but why not have a sheet for rel=&quot;alternate stylesheet&quot;? (bz?)

We have a sheet for rel=&quot;alternate stylesheet&quot; right after insertion into the DOM as far as I know, per above.  Just double-checked with a simple testcase, and it&apos;s there...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>58318</commentid>
    <comment_count>6</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-10-18 02:37:00 +0000</bug_when>
    <thetext>(In reply to comment #5)
&gt; &gt; In Gecko, &lt;link&gt; loading blocks parsing.
&gt; No, it does not.
&gt; It blocks execution of &lt;script&gt; elements, however.

Er, yeah, sorry. I meant in the demo above it blocks parsing, but of course the reason it does that is that it is blocking on execution of the inline script after the link.


&gt; &gt; In WebKit, .sheet is null until the sheet is loaded.
&gt; 
&gt; How is &quot;loaded&quot; defined?  If the sheet has @import rules, do those need to be
&gt; loaded too?  (Think esp. for &lt;style&gt;.)

I didn&apos;t investigate this closely, since it&apos;s not Web compatible anyway (whence this bug, in fact).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>58319</commentid>
    <comment_count>7</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2011-10-18 02:54:11 +0000</bug_when>
    <thetext>&gt; We have a sheet for rel=&quot;alternate stylesheet&quot; right after insertion

Subject to the whole &quot;determined to be a CSS stylesheet link&quot; thing.  In particular, rel=&quot;alternate stylesheet&quot; which does not have a nonempty title is NOT considered a CSS stylesheet link in Gecko, which is what the testcase in comment 3 is running into.  I&apos;m not wedded to this, offhand, but it&apos;s not quite clear what a browser should do with an alternate stylesheet with no title... (e.g. when is it enabled, if ever?)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>58322</commentid>
    <comment_count>8</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-10-18 03:23:06 +0000</bug_when>
    <thetext>Ok, I went with what Gecko does.

EDITOR&apos;S RESPONSE: This is an Editor&apos;s Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Accepted
Change Description: see diff given below
Rationale: Compat.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>58323</commentid>
    <comment_count>9</comment_count>
    <who name="">contributor</who>
    <bug_when>2011-10-18 03:27:01 +0000</bug_when>
    <thetext>Checked in as WHATWG revision r6693.
Check-in comment: Fix compat issue with .sheet and .disabled on external &lt;link&gt;
http://html5.org/tools/web-apps-tracker?from=6692&amp;to=6693</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>58324</commentid>
    <comment_count>10</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2011-10-18 03:32:51 +0000</bug_when>
    <thetext>For what it&apos;s worth, I believe in Gecko .sheet is also null if @type is set to some value other than &quot;&quot; or &quot;text/css&quot;.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>