W3C home > Mailing lists > Public > public-webapi@w3.org > March 2008

Re: [Bindings] 'new' behavior on interface objects

From: liorean <liorean@gmail.com>
Date: Wed, 19 Mar 2008 13:06:50 +0100
Message-ID: <cee13aa30803190506l6326102bs16c22cb36ea81982@mail.gmail.com>
To: "Web APIs WG (public)" <public-webapi@w3.org>

On 18/03/2008, Travis Leithead <travil@windows.microsoft.com> wrote:
>  Since this spec is presumably creating a language binding for JavaScript, (and assuming interface objects are Functions, as seen by Opera), then why does:
>
>  var div = new HTMLDivElement();
>
>  produce a script error?

Only having heard the explanation in third hand myself, I actually
don't know if it's the actual argument that was used or not. But as
I've had that explained to me, it's because originally, creating a
node must at the same time specify which document the node belongs to,
as well as whether it's an XML or HTML style node, was totally
meaningless.
Using special functions on the document for creating these nodes was
seen as the best answer to that problem, because the constructor would
know which document it belonged to and whether that was an HTML or XML
mode node. Thus using the language object construction feature was
seen as inappropriate, and something that shouldn't be used for node
creation in the DOM.
-- 
David "liorean" Andersson
Received on Wednesday, 19 March 2008 12:07:29 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 19 March 2008 12:07:30 GMT