W3C home > Mailing lists > Public > www-dom-ts@w3.org > April 2008

Why do we use Document object to create Element ?

From: 叶现一 <yexianyi@hotmail.com>
Date: Tue, 22 Apr 2008 08:46:34 +0000
Message-ID: <BAY129-W52885F685871AC5CB254A7DDE00@phx.gbl>
To: <www-dom-ts@w3.org>
I have a question about create Element , TextNode or anything else like that in DOM. 
 
Why do we use Document object to create Element ? 
For Example: TextNode el = document.createTextNode("name").And then add el to one node.
 
Why don't we design a class like TextNode ? 
And then instantiate it directly like  TextNode el = new TextNode().
Finally,use a node to add it,like node.appendChild(el).
 
 
I think that we use  Document object to create Element is unnecessary and is not fit to our thinking.
 
 
Do you have any suggestions about that ?
If you have ,Please send e-mail to yexianyi@hotmail.com
 
Thanks very much!
_________________________________________________________________
Windows Live Photo gallery 数码相机的超级伴侣,轻松管理和编辑照片,还能制作全景美图!
http://get.live.cn/product/photo.html
Received on Wednesday, 23 April 2008 01:36:21 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 6 April 2009 12:58:50 GMT