Re: [whatwg] defer on style, depends

2009-02-15 Thread Garrett Smith
On Fri, Feb 13, 2009 at 12:34 AM, Ian Hickson i...@hixie.ch wrote: On Mon, 9 Feb 2009, Boris Zbarsky wrote: Ian Hickson wrote: I'm not convinced either of these are really great solutions. I think it'd be better just to have the script itself only block when it hits CSS-dependent APIs

Re: [whatwg] defer on style, depends

2009-02-15 Thread Boris Zbarsky
Garrett Smith wrote: Because you have scripts after your stylesheets, not just stylesheets. Really, controlled experiments are hard. You have to hold all but one variable constant. OK, I modified the example: http://localhost/jstest/block/link-img-noscript.html The bottom script will not

Re: [whatwg] defer on style, depends

2009-02-15 Thread Boris Zbarsky
Ian Hickson wrote: On Fri, 13 Feb 2009, Boris Zbarsky wrote: The current Gecko behavior is that any stylesheet load started by parsing a style or link tag will increment a counter on the document (well, on a per-document script loader object, to be more precise). Completion of the load will

Re: [whatwg] defer on style, depends

2009-02-15 Thread Garrett Smith
On Sun, Feb 15, 2009 at 9:54 AM, Boris Zbarsky bzbar...@mit.edu wrote: Garrett Smith wrote: Because you have scripts after your stylesheets, not just stylesheets. Really, controlled experiments are hard. You have to hold all but one variable constant. OK, I modified the example:

Re: [whatwg] defer on style, depends

2009-02-15 Thread Boris Zbarsky
Garrett Smith wrote: I can see why rule matching would happen for all nodes in the document. On what occasion(s) do(es) that algorithm run? Depends on the UA, probably. For Gecko in particular, any time a stylesheet is added to or removed from the document, any time a rule is added to or

Re: [whatwg] defer on style, depends

2009-02-14 Thread Garrett Smith
On Thu, Feb 12, 2009 at 8:41 AM, Boris Zbarsky bzbar...@mit.edu wrote: Garrett Smith wrote: In Shiretoko, a script, even a deferred script, will not run until the stylesheet is loaded. Correct. Can we make an improvement on that, or to make that improvement configurable to the page

Re: [whatwg] defer on style, depends

2009-02-13 Thread Ian Hickson
On Mon, 9 Feb 2009, Boris Zbarsky wrote: Ian Hickson wrote: I'm not convinced either of these are really great solutions. I think it'd be better just to have the script itself only block when it hits CSS-dependent APIs (though I recognise that that is a much harder problem in most

Re: [whatwg] defer on style, depends

2009-02-13 Thread Boris Zbarsky
Ian Hickson wrote: By the way, the spec doesn't yet require the blocking behavior. I couldn't work out how to do it. Could you elaborate on when exactly in the process the style sheet is waited on? Does it happen for all scripts? For example, if a script inserts a style sheet and then a

Re: [whatwg] defer on style, depends

2009-02-13 Thread Ian Hickson
On Fri, 13 Feb 2009, Boris Zbarsky wrote: The current Gecko behavior is that any stylesheet load started by parsing a style or link tag will increment a counter on the document (well, on a per-document script loader object, to be more precise). Completion of the load will decrement the

Re: [whatwg] defer on style, depends

2009-02-12 Thread Boris Zbarsky
Garrett Smith wrote: I would be fine with a way to flag scripts with that information, though there is a catch-22: if you flag such a script and it DOES depend on style information, then existing UAs will get it right and any UA implementing the new spec will get it wrong. If the page does

Re: [whatwg] defer on style, depends

2009-02-11 Thread Garrett Smith
On Mon, Feb 9, 2009 at 7:37 PM, Boris Zbarsky bzbar...@mit.edu wrote: Garrett Smith wrote: In general, I want better declarative control over loading external resources. The solution(s) should not cause compatibility problems with existing browsers (because I have to support IE6 and Firefox

Re: [whatwg] defer on style, depends

2009-02-09 Thread Ian Hickson
On Sun, 8 Feb 2009, Jonas Sicking wrote: This will allow browsers to not block on those elements. Browsers are already allowed to not block on those elements. Well, Garrett is somewhat correct. For example in the following scenario: link rel=stylesheet href=external.css script

Re: [whatwg] defer on style, depends

2009-02-09 Thread Garrett Smith
On Sun, Feb 8, 2009 at 9:20 PM, Ian Hickson i...@hixie.ch wrote: On Sun, 8 Feb 2009, Garrett Smith wrote: Sometimes a document's resources are not needed all at first. For example, a script that is not needed until after the document is parsed can be given the defer attribute (for browsers

Re: [whatwg] defer on style, depends

2009-02-09 Thread Ian Hickson
On Mon, 9 Feb 2009, Garrett Smith wrote: On Sun, Feb 8, 2009 at 9:20 PM, Ian Hickson i...@hixie.ch wrote: On Sun, 8 Feb 2009, Garrett Smith wrote: Sometimes a document's resources are not needed all at first. For example, a script that is not needed until after the document is parsed

Re: [whatwg] defer on style, depends

2009-02-09 Thread Thomas Broyer
On Mon, Feb 9, 2009 at 9:23 AM, Ian Hickson wrote: I'm not convinced either of these are really great solutions. I think it'd be better just to have the script itself only block when it hits CSS-dependent APIs (though I recognise that that is a much harder problem in most rendering engines

Re: [whatwg] defer on style, depends

2009-02-09 Thread Boris Zbarsky
Ian Hickson wrote: I'm not convinced either of these are really great solutions. I think it'd be better just to have the script itself only block when it hits CSS-dependent APIs (though I recognise that that is a much harder problem in most rendering engines today). I'm not sure how you

Re: [whatwg] defer on style, depends

2009-02-09 Thread Boris Zbarsky
Jonas Sicking wrote: Well, Garrett is somewhat correct. For example in the following scenario: link rel=stylesheet href=external.css script doStuff(); /script In gecko, when we parse the script tag, we'll block until all external stylesheets have finished loading before we start executing

Re: [whatwg] defer on style, depends

2009-02-09 Thread Garrett Smith
On Mon, Feb 9, 2009 at 2:26 AM, Ian Hickson i...@hixie.ch wrote: On Mon, 9 Feb 2009, Garrett Smith wrote: On Sun, Feb 8, 2009 at 9:20 PM, Ian Hickson i...@hixie.ch wrote: On Sun, 8 Feb 2009, Garrett Smith wrote: Sometimes a document's resources are not needed all at first. For example, a

Re: [whatwg] defer on style, depends

2009-02-09 Thread Boris Zbarsky
Garrett Smith wrote: The script's defer attribute does not work in a majority of implementations. For such browsers, it makes sense to put the script lower on the page for performance reasons, not before the linked stylesheets. Moving the deferred script from the bottom of the page to the head,

Re: [whatwg] defer on style, depends

2009-02-09 Thread Garrett Smith
On Mon, Feb 9, 2009 at 9:42 AM, Boris Zbarsky bzbar...@mit.edu wrote: Garrett Smith wrote: The script's defer attribute does not work in a majority of implementations. For such browsers, it makes sense to put the script lower on the page for performance reasons, not before the linked

Re: [whatwg] defer on style, depends

2009-02-09 Thread Boris Zbarsky
Garrett Smith wrote: There are two/three issues. 1) want to load stylesheets without having scripts block Already doable for alternate stylesheets, right? I assume the use case is a script that wants to modify the DOM immediately but doesn't depend on any styling information? That's a

Re: [whatwg] defer on style, depends

2009-02-09 Thread Garrett Smith
On Mon, Feb 9, 2009 at 11:54 AM, Boris Zbarsky bzbar...@mit.edu wrote: Garrett Smith wrote: There are two/three issues. 1) want to load stylesheets without having scripts block Already doable for alternate stylesheets, right? An html document could contain an alternate stylesheet, intended

Re: [whatwg] defer on style, depends

2009-02-09 Thread Boris Zbarsky
Garrett Smith wrote: In general, I want better declarative control over loading external resources. The solution(s) should not cause compatibility problems with existing browsers (because I have to support IE6 and Firefox 2). Honestly, by the time anything we're discussing now will be shipping

[whatwg] defer on style, depends

2009-02-08 Thread Garrett Smith
Sometimes a document's resources are not needed all at first. For example, a script that is not needed until after the document is parsed can be given the defer attribute (for browsers that support defer). External css can also be a blocking download. Scripts have defer attribute, but style and

Re: [whatwg] defer on style, depends

2009-02-08 Thread Ian Hickson
On Sun, 8 Feb 2009, Garrett Smith wrote: Sometimes a document's resources are not needed all at first. For example, a script that is not needed until after the document is parsed can be given the defer attribute (for browsers that support defer). External css can also be a blocking

Re: [whatwg] defer on style, depends

2009-02-08 Thread Jonas Sicking
On Sun, Feb 8, 2009 at 9:20 PM, Ian Hickson i...@hixie.ch wrote: On Sun, 8 Feb 2009, Garrett Smith wrote: Sometimes a document's resources are not needed all at first. For example, a script that is not needed until after the document is parsed can be given the defer attribute (for browsers