Re: Wanting to understand the load event for inline scripts

On Wed, Nov 10, 2010 at 2:33 PM, Travis Leithead <travil@microsoft.com> wrote:
> Ian & Co.,
>
> IE9 has implemented the behavior for firing a load event on script elements,
> even script elements that are inline scripts only, which I believe is
> correct per step 5 of the "Executing a script block" -> "If the load was
> successful" steps: "Otherwise, the script is internal; queue a task to fire
> a simple event named load at the script element."
>
> In my latest testing, no other browser implements this behavior. We have yet
> to see a compatibility problem from this behavior, but we did get a customer
> bug filed against this behavior :-)
>
> My question is simple: What is the justification for this behavior in the
> spec?
>
> Follow-up question: Will other browser venders implement this behaviors
> also?

Ooh, I didn't realize that behavior was specced. I experimented with
the script load event recently and was surprised by the fact that it
doesn't fire for inline scripts, though it does make a fair amount of
sense.

I don't have a strong opinion either way, if people agree it should be
in the spec then we'll implement it for the next version of firefox.

I've suggested on the whatwg list, and implemented in firefox 4, a set
of beforescriptexecute/afterscriptexecute which execute right before
and right after a script is executed. The afterscriptexecute *might*
be a better alternative to making 'load' fire for inline scripts if we
want to keep the 'load' event network related.

Though arguably 'load' is already not fully network related since it
doesn't (at least in firefox) fire if the script fails to parse.

/ Jonas

Received on Wednesday, 10 November 2010 22:44:09 UTC