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

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 UTC