- From: Rick Waldron <waldron.rick@gmail.com>
- Date: Wed, 26 Oct 2011 18:57:37 -0400
- To: Cameron McCormack <cam@mcc.id.au>
- Cc: public-webapps@w3.org
Received on Wednesday, 26 October 2011 22:58:31 UTC
On Wed, Oct 26, 2011 at 4:33 PM, Cameron McCormack <cam@mcc.id.au> wrote:
> On 25/10/11 8:54 PM, Adam Barth wrote:
>
>> Another solution to that "more than one tag per interface" problem is
>> to introduce subclasses of those interfaces for each tag.
>>
>
> Instead of introducing more interfaces (which don't have additional
> functionality), and instead of introducing Element.create, I would rather
> see a pattern like:
>
> var e = new Element("div", ...);
>
This exists in the Prototype.js lib (
http://api.prototypejs.org/dom/Element/new/) which has seen massive
abandonment in the past 3-4 years.
>
> There is no requirement that the object returned from a constructor be an
> object that has the constructor.prototype as its [[Prototype]], so having
> the above constructor return an HTMLDivElement is fine.
>
> (Also note that the constructor text nodes should be Text rather than
> TextNode, according to the interface name in DOM Core.)
>
>
Received on Wednesday, 26 October 2011 22:58:31 UTC