今天在看书时看到一个函数:createAttribute()
在其他的书籍中,大部分情况下是使用setAttribute()、getAttribute()来设置和读取属性.
请问createAttribute()是DOM提供的标准函数吗?
那为什么没有人使用呢?
是没有得到大部分浏览器的支持吗?
有什么浏览器支持这个DOM方法啊?
还有就是在DOM中节点之间的关系基本上就是:
父子关系、兄弟关系。
请问属性节点和它的元素节点是什么关系啊?
还有注释节点又怎么理解呢?
它跟谁有直接的关系啊?
在其他的书籍中,大部分情况下是使用setAttribute()、getAttribute()来设置和读取属性.
请问createAttribute()是DOM提供的标准函数吗?
那为什么没有人使用呢?
是没有得到大部分浏览器的支持吗?
有什么浏览器支持这个DOM方法啊?
还有就是在DOM中节点之间的关系基本上就是:
父子关系、兄弟关系。
请问属性节点和它的元素节点是什么关系啊?
还有注释节点又怎么理解呢?
它跟谁有直接的关系啊?
IE6以上支持createAttribute().
微软文档对属性和元素的解释:
Although attributes belong to a particular element, they are not considered child nodes of element nodes. Instead, they behave more like properties of IXMLDOMElement.DOM2有关结构的定义:
•Document -- Element (maximum of one), ProcessingInstruction, Comment, DocumentType (maximum of one)
•DocumentFragment -- Element, ProcessingInstruction, Comment, Text, CDATASection, EntityReference
•DocumentType -- no children
•EntityReference -- Element, ProcessingInstruction, Comment, Text, CDATASection, EntityReference
•Element -- Element, Text, Comment, ProcessingInstruction, CDATASection, EntityReference
•Attr -- Text, EntityReference
•ProcessingInstruction -- no children
•Comment -- no children
•Text -- no children
•CDATASection -- no children
•Entity -- Element, ProcessingInstruction, Comment, Text, CDATASection, EntityReference
•Notation -- no children