[whatwg] should we add beforeload/afterload events to the web platform?

On Thu, Jan 12, 2012 at 6:59 PM, Boris Zbarsky <bzbarsky at mit.edu> wrote:
> On 1/12/12 9:23 PM, Roman Rudenko wrote:
>>
>> Blocking is possible under some circumstances. Webkit differentiates
>> between normal parser and speculative parser. Speculative parser is
>> launched only if normal parser is blocked on execution of a script.
>> So, one could use beforeload to block resources in Webkit, for as long
>> as no synchronous scripts are allowed to slip through. Unfortunately,
>> one runaway script blocks the parser and spoils blocking for anything
>> after itself.
>
>
> I just thought about this some more... ?This caveat makes beforeload not
> very helpful for blocking or redirecting loads from only part of a document,
> and for blocking loads from the whole document there are the better
> solutions mentioned earlier in this thread.

True. In its current form, beforeload is not very useful for partial processing.
What if we had 'beforedownload' event specifically for resource
fetching, and constructed stub elements to feed it as event.target
when load is readahead-induced? Even the basic tagName + attributes
stub with no manipulation or way to find own context would be useful
and not particularly hard to construct.

-- 
Roman Rudenko

Received on Thursday, 12 January 2012 23:50:09 UTC