Re: [whatwg] Link.onload; defer on style, depends

2009-06-05 Thread Ian Hickson
On Thu, 30 Apr 2009, Sean Hogan wrote: Ian Hickson wrote: On Thu, 30 Apr 2009, Sean Hogan wrote: How do I check if the resource is already loaded? In a cross-browser, cross-site manner? Put an onload handler on the element before it loads and make it set a flag you can check

Re: [whatwg] Link.onload; defer on style, depends

2009-06-04 Thread Ian Hickson
On Tue, 28 Apr 2009, Boris Zbarsky wrote: Ian Hickson wrote: Ah, yes. good point. I can require that relatively simply (just have the tasks that are queued for 'load' events themselves delay the page's load event) That's exactly what Gecko does. should I? I'd prefer that, but I'd

Re: [whatwg] Link.onload; defer on style, depends

2009-04-29 Thread Sean Hogan
Ian Hickson wrote: On Wed, 25 Mar 2009, Sean Hogan wrote: Ian Hickson wrote: On Sun, 15 Mar 2009, Boris Zbarsky wrote: Sean Hogan wrote: This is a request for the link element to be given an onload attribute. And presumably a readyState property.

Re: [whatwg] Link.onload; defer on style, depends

2009-04-29 Thread Ian Hickson
On Thu, 30 Apr 2009, Sean Hogan wrote: At least in Gecko, you can already detect whether the sheet is done loading: if you try to get its cssRules and that throws INVALID_ACCESS_ERR, then it's still loading. (If it throws DOM_SECURITY_ERR then you're not

Re: [whatwg] Link.onload; defer on style, depends

2009-04-29 Thread Sean Hogan
Ian Hickson wrote: On Thu, 30 Apr 2009, Sean Hogan wrote: At least in Gecko, you can already detect whether the sheet is done loading: if you try to get its cssRules and that throws INVALID_ACCESS_ERR, then it's still loading. (If it throws DOM_SECURITY_ERR then you're not

Re: [whatwg] Link.onload; defer on style, depends

2009-04-28 Thread Ian Hickson
On Mon, 27 Apr 2009, Boris Zbarsky wrote: Ian Hickson wrote: The spec requires the page 'load' event to be fired asynchronously. (There's no black-box way to distinguish this from the case of waiting for the other 'load' events to have fired, as far as I can tell.) Phrased that way,

Re: [whatwg] Link.onload; defer on style, depends

2009-04-28 Thread Boris Zbarsky
Ian Hickson wrote: As far as I can tell, as specced, there isn't a race condition (other than the inherent network race condition). http://www.whatwg.org/specs/web-apps/current-work/#delay-the-load-event In this case: body onload=2 img onload=1; image = new Image(); image.src =

Re: [whatwg] Link.onload; defer on style, depends

2009-04-28 Thread Ian Hickson
On Tue, 28 Apr 2009, Boris Zbarsky wrote: The testcase I was thinking of is: body onload=3 img onload=1; image = new Image(); image.src = 'test'; image.onload = 2 src=foo img src=bar In Gecko, on this testcase, the handlers always run in the order 1, 2, 3. Ah, yes. good

Re: [whatwg] Link.onload; defer on style, depends

2009-04-28 Thread Boris Zbarsky
Ian Hickson wrote: Ah, yes. good point. I can require that relatively simply (just have the tasks that are queued for 'load' events themselves delay the page's load event) That's exactly what Gecko does. should I? I'd prefer that, but I'd be interested in feedback from other implementors.

Re: [whatwg] Link.onload; defer on style, depends

2009-04-27 Thread Ian Hickson
On Wed, 25 Mar 2009, Boris Zbarsky wrote: On Sat, 14 Mar 2009, Greg Houston wrote: On a side note, I can actually attach a functioning onload event to a link element in Internet Explorer. Firefox, Safari, and Chrome ignore my attempt, and Opera will fire the onload event but not

Re: [whatwg] Link.onload; defer on style, depends

2009-04-27 Thread Ian Hickson
On Wed, 25 Mar 2009, Sean Hogan wrote: Ian Hickson wrote: On Sun, 15 Mar 2009, Boris Zbarsky wrote: Sean Hogan wrote: This is a request for the link element to be given an onload attribute. And presumably a readyState property. At least in Gecko, you can already

Re: [whatwg] Link.onload; defer on style, depends

2009-04-27 Thread Boris Zbarsky
Ian Hickson wrote: The spec requires the page 'load' event to be fired asynchronously. (There's no black-box way to distinguish this from the case of waiting for the other 'load' events to have fired, as far as I can tell.) Phrased that way, yes. But maybe I wasn't clear on the exact

Re: [whatwg] Link.onload; defer on style, depends

2009-04-27 Thread Boris Zbarsky
Boris Zbarsky wrote: Ian Hickson wrote: The spec requires the page 'load' event to be fired asynchronously. (There's no black-box way to distinguish this from the case of waiting for the other 'load' events to have fired, as far as I can tell.) Phrased that way, yes. Or did I misunderstand

Re: [whatwg] Link.onload; defer on style, depends

2009-03-25 Thread Sean Hogan
Ian Hickson wrote: On Sun, 15 Mar 2009, Boris Zbarsky wrote: Sean Hogan wrote: This is a request for the link element to be given an onload attribute. And presumably a readyState property. At least in Gecko, you can already detect whether the sheet is done loading: if

Re: [whatwg] Link.onload; defer on style, depends

2009-03-25 Thread Boris Zbarsky
Ian Hickson wrote: So testing this: http://software.hixie.ch/utilities/js/live-dom-viewer/saved/44 http://software.hixie.ch/utilities/js/live-dom-viewer/saved/45 (44 uses currentStyle, for IE/Opera, 45 uses getComputedStyle, for Opera/ Firefox/Safari) It seems Gecko is the only engine

Re: [whatwg] Link.onload; defer on style, depends

2009-03-25 Thread Boris Zbarsky
Boris Zbarsky wrote: No. What's paused is execution of new scripts, not of existing ones. So in this case, b() executes immediately, while a() executes after the stylesheet loads. Woah, so this can affect the order of script execution? Yes, just like document.write(script src=...) would,

Re: [whatwg] Link.onload; defer on style, depends

2009-03-25 Thread Jonas Sicking
On Tue, Mar 24, 2009 at 7:24 PM, Ian Hickson i...@hixie.ch wrote: On Sun, 15 Feb 2009, Boris Zbarsky wrote: So in this:    !DOCTYPE html    ...    script     document.write('link rel=stylesheet href=style');     document.write('scripta();\/script');     b();    /script

Re: [whatwg] Link.onload; defer on style, depends

2009-03-24 Thread Ian Hickson
On Fri, 13 Feb 2009, Boris Zbarsky wrote: 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,

Re: [whatwg] Link.onload

2009-03-15 Thread Jonas Sicking
On Sat, Mar 14, 2009 at 10:21 PM, Garrett Smith dhtmlkitc...@gmail.com wrote: On Sat, Mar 14, 2009 at 6:54 PM, Jonas Sicking jo...@sicking.cc wrote: On Sat, Mar 14, 2009 at 1:48 PM, Greg Houston gregory.hous...@gmail.com wrote: [...] Garrett: Whatever we decide when it comes to the defer

Re: [whatwg] Link.onload

2009-03-15 Thread Sean Hogan
Greg Houston wrote: This is a request for the link element to be given an onload attribute. And presumably a readyState property.

Re: [whatwg] Link.onload

2009-03-15 Thread Mike Wilson
Jonas Sicking wrote on 15 mars 2009 02:55: On Sat, Mar 14, 2009 at 1:48 PM, Greg Houston gregory.hous...@gmail.com wrote: This is a request for the link element to be given an onload attribute. This sounds like a good idea to me. Seems useful for dynamically added stylesheets too, and

Re: [whatwg] Link.onload

2009-03-15 Thread Boris Zbarsky
Sean Hogan wrote: This is a request for the link element to be given an onload attribute. And presumably a readyState property. At least in Gecko, you can already detect whether the sheet is done loading: if you try to get its cssRules and that throws INVALID_ACCESS_ERR, then it's still

Re: [whatwg] Link.onload

2009-03-15 Thread Boris Zbarsky
Jonas Sicking wrote: This sounds like a good idea to me. Seems useful for dynamically added stylesheets too, and possibly for stylesheets where the href attribute is dynamically changed. Same thing goes for the style element since an inline stylesheet can have @import rules. Indeed, and there

Re: [whatwg] Link.onload

2009-03-15 Thread Kristof Zelechovski
Here is how to obtain the functionality of a deferred style sheet for a run-time dialogue box: the semantics of the depends attribute must be changed so that it causes all script code *except function definitions* to wait for the style sheet to load (and perhaps cause it to load as well); whereas

Re: [whatwg] Link.onload

2009-03-15 Thread Garrett Smith
On Sun, Mar 15, 2009 at 12:07 AM, Jonas Sicking jo...@sicking.cc wrote: On Sat, Mar 14, 2009 at 10:21 PM, Garrett Smith dhtmlkitc...@gmail.com wrote: On Sat, Mar 14, 2009 at 6:54 PM, Jonas Sicking jo...@sicking.cc wrote: On Sat, Mar 14, 2009 at 1:48 PM, Greg Houston gregory.hous...@gmail.com

Re: [whatwg] Link.onload

2009-03-15 Thread Boris Zbarsky
Garrett Smith wrote: On Sun, Mar 15, 2009 at 12:07 AM, Jonas Sicking jo...@sicking.cc wrote: link.onload = function() { displayDialog(Dialog Title, someObject); } Why not implement EventTarget on link? For example: link.addEventListener('load', displayDialog, true); It's the same thing.

Re: [whatwg] Link.onload

2009-03-14 Thread Garrett Smith
On Sat, Mar 14, 2009 at 1:48 PM, Greg Houston gregory.hous...@gmail.com wrote: This is a request for the link element to be given an onload attribute. I see. Often when lazy loading a plugin into an web app it is necessary for the plugin's stylesheets to be applied before the plugin's

Re: [whatwg] Link.onload

2009-03-14 Thread Greg Houston
On Sat, Mar 14, 2009 at 4:46 PM, Garrett Smith dhtmlkitc...@gmail.com wrote: I proposed a solution to a similar problem not too long ago. script depends=[idref] .../script For me to implement my own depends lazy loader without any hacks the only thing missing is that link onload callback.

Re: [whatwg] Link.onload

2009-03-14 Thread Garrett Smith
On Sat, Mar 14, 2009 at 5:24 PM, Greg Houston gregory.hous...@gmail.com wrote: On Sat, Mar 14, 2009 at 4:46 PM, Garrett Smith dhtmlkitc...@gmail.com wrote: I proposed a solution to a similar problem not too long ago. script depends=[idref] .../script For me to implement my own depends lazy

Re: [whatwg] Link.onload

2009-03-14 Thread Jonas Sicking
On Sat, Mar 14, 2009 at 1:48 PM, Greg Houston gregory.hous...@gmail.com wrote: This is a request for the link element to be given an onload attribute. Often when lazy loading a plugin into an web app it is necessary for the plugin's stylesheets to be applied before the plugin's JavaScript is

Re: [whatwg] Link.onload

2009-03-14 Thread Garrett Smith
On Sat, Mar 14, 2009 at 6:54 PM, Jonas Sicking jo...@sicking.cc wrote: On Sat, Mar 14, 2009 at 1:48 PM, Greg Houston gregory.hous...@gmail.com wrote: [...] Garrett: Whatever we decide when it comes to the defer attribute, it is always useful to have scripting APIs as well. There is just no