W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2000

Re: Document::createAttribute()

From: <keshlam@us.ibm.com>
Date: Thu, 30 Mar 2000 10:10:51 -0500
To: www-dom@w3.org
Message-ID: <852568B2.00536571.00@D51MTA03.pok.ibm.com>
>What was the rationale behind having the createAttribute() factory
>method in Document instead of Element?

Weak rationalle: An Attr, like most other nodes, is always associated with
an owning document. It isn't associated with an Element until it's bound to
one via setAttributeNode[NS].

> wouldn't it make more sense to have the factory method in Element?

There is one: the setAttribute() call. More convenient if the Attr's value
will be a single Text node, less convenient if it will be more complicated.

______________________________________
Joe Kesselman  / IBM Research
Received on Thursday, 30 March 2000 10:11:10 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:47 GMT