[whatwg] style sheet blocking scripts

Jonas Sicking jonas at sicking.cc
Wed Dec 9 15:19:38 PST 2009


On Wed, Dec 9, 2009 at 3:18 PM, Jonas Sicking <jonas at sicking.cc> wrote:
> On Wed, Dec 9, 2009 at 3:06 PM, James Robinson <jamesr at google.com> wrote:
>> On Wed, Dec 9, 2009 at 2:57 PM, Jonas Sicking <jonas at sicking.cc> wrote:
>>>
>>> On Wed, Dec 9, 2009 at 2:10 PM, James Robinson <jamesr at google.com> wrote:
>>> > 2009/12/9 tali garsiel <t_garsiel at hotmail.com>
>>> >>
>>> >> Well, not completely.
>>> >> Regarding the first question- Webkit guys told me (on their IRC
>>> >> channel)
>>> >> that the don't block the parser and only block scripts that request
>>> >> visual
>>> >> information, so I'm still  confused.
>>> >
>>> > Here's my understanding of the implementation inside WebKit currently:
>>> > During parsing, WebKit does not block the parser on stylesheet loads,
>>> > but
>>> > does block external scripts from running until previously-encountered
>>> > stylesheets have loaded.  WebKit does not suspend script execution on
>>> > requests for visual information if stylesheets have not loaded (for
>>> > example
>>> > for inline scripts or in the case of stylesheets added dynamically after
>>> > parsing has completed).  WebKit does suspend parsing of the document on
>>> > script loads, but has a speculative preloader to attempt to start
>>> > fetches
>>> > for resources past the <script> tag.
>>>
>>> Why does webkit treat external scripts different from inline scripts
>>> here? I.e. why is an inline script allowed to run even if there are
>>> pending stylesheet loads, but external scripts not? That seems
>>> inconsistent and confusing.
>>>
>>> Is this considered a bug or desired behavior?
>>
>> The
>> former: http://trac.webkit.org/browser/trunk/WebCore/html/HTMLTokenizer.cpp#L2017
>> I'm not sure how much this matters in practice.  In theory, this is
>> unobservable to the page unless it queries the loaded stylesheets directly
>> or a property derived from layout both of which should suspend script
>> execution.
>
> Why is this more "in theory" for inline scripts than for external scripts?

Or rather, why is this more unobservable for inline scripts than for
external scripts?

/ Jonas



More information about the whatwg mailing list