[webkit-dev] GlobalScript API.

Dmitry Titov dimich at chromium.org
Wed Sep 2 01:01:42 PDT 2009


On Tue, Sep 1, 2009 at 8:07 PM, Maciej Stachowiak <mjs at apple.com> wrote:

>
> instead of
> var globalScript = new webkitGlobalScript(name, url, loadHandler,
> errorHandler);
>
> to have this:
> <webkit-globalscript name='...', src='url', onload=...
> onerror=...></webkit-globalscript>
>
> The first tag with a specific name that provides a src or inline script or
> injected with innerText would effectively supply 'initial script'. The
> later-encountered tags withthe same name would have their initial script
> ignored and simply connected to the same one. The tag's DOM element would be
> EventTarget (for load and error) and have a 'context' property to pull the
> global scope object of the script.
>
>
> Why is a tag better for this than a constructor or function?
>

I'm not saying it's better. The tag idea was brought more then once before
so I think it is worth considered.I think the motivation behind it is to be
able to hook up event handlers before loading ends to be notified when the
context is ready. Constructor with callbacks can do the similar thing, imo.

Dmitry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20090902/620fa248/attachment.html>


More information about the webkit-dev mailing list