W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2013

Re: Monkeypatching document.createElement() is wrong

From: Dimitri Glazkov <dglazkov@chromium.org>
Date: Tue, 12 Feb 2013 09:06:03 -0800
Message-ID: <CADh5Ky0ETK7rXs2tEtSgbKd9Gx+5aWZGM0phW1PPFyzv2zXj7A@mail.gmail.com>
To: Anne van Kesteren <annevk@annevk.nl>
Cc: WebApps WG <public-webapps@w3.org>
On Tue, Feb 12, 2013 at 3:24 AM, Anne van Kesteren <annevk@annevk.nl> wrote:

> If the goal of custom elements is to expose the guts of what happens
> https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/custom/index.html#monkeypatch-create-element
> is the wrong solution. Currently new Image() and createElement("img")
> are equivalent and no additional magic is required. Same for new
> Audio() and createElement("audio"). What we want is that
> var x = document.createElement(name)
> maps to / is identical to
> var x = new name's-corresponding-object
> and nothing else.

... and that's exactly how custom elements are being spec'd. See how
constructor is generated:

By the wrongness, do you mean the running shadow tree instantiation and
element finalization steps? If so, they are workarounds for our inability
to define an author-defined constructor.

There's a nice thread that tries to enable this and eliminate these extra
steps, but from what I understand, there's a monkey wrench thrown by
inability of current JS engines to accommodate the proposed design:

Received on Tuesday, 12 February 2013 17:06:32 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:13:58 UTC