Why do we use Document object to create Element ?
叶现一 <[email protected]> Tue, 22 Apr 2008 08:46:34 +0000
| Newsgroups | gmane.comp.web.dom.test-suites.general |
|---|---|
| Message-ID | <[email protected]> |
--_52373470-a1e8-422c-a016-3c4005364ec2_
Content-Type: text/plain; charset="gb2312"
Content-Transfer-Encoding: 8bit
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 [email protected]
Thanks very much!
_________________________________________________________________
Windows Live Photo gallery ÊýÂëÏà»úµÄ³¬¼¶°é£¬ÇáËɹÜÀíºÍ±à¼ÕÕÆ¬£¬»¹ÄÜÖÆ×÷È«¾°ÃÀͼ£¡
http://get.live.cn/product/photo.html
--_52373470-a1e8-422c-a016-3c4005364ec2_
Content-Type: text/html; charset="gb2312"
Content-Transfer-Encoding: 8bit
<html>
<head>
<style>
..hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 9pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class='hmmessage'><FONT size=4>I have a question about create Element , TextNode or anything else like that in DOM. </FONT><BR>
<FONT size=4></FONT> <BR>
<FONT size=4>Why do we use Document object to create Element ? </FONT><BR>
<FONT size=4>For Example: TextNode el = document.createTextNode("name").And then add el to one node.</FONT><BR>
<FONT size=4></FONT> <BR>
<FONT size=4>Why don't we design a class like TextNode ? </FONT><BR>
<FONT size=4>And then instantiate it directly like TextNode el = new TextNode().</FONT><BR>
<FONT size=4>Finally,use a node to add it,like node.appendChild(el).</FONT><BR>
<FONT size=4></FONT> <BR>
<FONT size=4></FONT> <BR>
<FONT size=4>I think that we use Document object to create Element is unnecessary and is not fit to our thinking.</FONT><BR>
<FONT size=4></FONT> <BR>
<FONT size=4></FONT> <BR>
<FONT size=4>Do you have any suggestions about that ?</FONT><BR>
<FONT size=4>If you have ,Please send e-mail to <A href="mailto:[email protected]">[email protected]</A></FONT><BR>
<FONT size=4></FONT> <BR>
<FONT size=4>Thanks very much!</FONT><BR><br /><hr />ʹÓÃÐÂÒ»´ú Windows Live Messenger ÇáËɽ»Á÷ºÍ¹²Ïí£¡ <a href='http://messenger.live.cn/' target='_new'>Á¢¼´ÌåÑ飡</a></body>
</html>
--_52373470-a1e8-422c-a016-3c4005364ec2_--