XML DOM - Element ɗanin

Element object represents element ɗin XML document. Element can contain properties, other elements or text. If element contains text, it is represented in text node.

Element object represents element ɗin XML document. Element can contain properties, other elements or text. If element contains text, it is represented in text node.

Element object

Element object represents element ɗin XML document. Element can contain properties, other elements or text. If element contains text, it is represented in text node.Important matter:

Because element object is also a node, it can inherit properties and methods ɗin Node object.

Properties ɗin Element object

Properties Description IE F O W3C
attributes Return NamedNodeMap ɗin properties ɗin element 5 1 9 Yes
baseURI Return absolute base URI ɗin element No 1 No Yes
childNodes Return NodeList ɗin child nodes ɗin element 5 1 9 Yes
firstChild Return first child ɗin element 5 1 9 Yes
lastChild Return last child ɗin element 5 1 9 Yes
localName Return local part ɗin name ɗin element No 1 9 Yes
namespaceURI Return URI ɗin namespace ɗin element No 1 9 Yes
nextSibling Return dace ɗin yadda daceyoyin ɗin yadda yana shafin dace ɗin yadda 5 1 9 Yes
nodeName Return name ɗin node, kama yadda type ɗin yadda 5 1 9 Yes
nodeType Return type ɗin node 5 1 9 Yes
ownerDocument Return root element ɗin document ɗin yadda 5 1 9 Yes
parentNode Return parent node ɗin element 5 1 9 Yes
prefix Set or return prefix ɗin namespace ɗin element No 1 9 Yes
previousSibling Return dace ɗin yadda daceyoyin ɗin yadda yana shafin dace ɗin yadda 5 1 9 Yes
schemaTypeInfo Return type information ɗin yadda element     No Yes
tagName Return name ɗin element 5 1 9 Yes
textContent Set or return text content ɗin element kuma daceyoyin ɗin yadda No 1 No Yes
text Return dace kuma daceyoyin ɗin yadda text (IE-only) 5 No No No
xml Return dace kuma daceyoyin ɗin yadda XML (IE-only) 5 No No No

Methods ɗin Element object

Method Description IE F O W3C
appendChild() Adda ɗanɗin dace shirin ɗin kala ɗanɗin shafin 5 1 9 Yes
cloneNode() Gin dace ɗin shirin 5 1 9 Yes
compareDocumentPosition() Compare kundin kamaruwa ɗin daceyoyin No 1 No Yes
dispatchEvent() A gina gargaɗa shafin kan dace ɗin shirin No 1 9 Yes
getAttribute() 返回属性的值。 5 1 9 Yes
getAttributeNS() 返回属性的值。 No 1 9 Yes
getAttributeNode() 以 Attribute 对象返回属性节点。 5 1 9 Yes
getAttributeNodeNS() 以 Attribute 对象返回属性节点。 No   9 Yes
getElementsByTagName() 找到具有指定标签名的子孙元素。 5 1 9 Yes
getElementsByTagNameNS() 找到具有指定标签名和命名空间的元素。 No 1 9 Yes
getFeature(feature,version) 返回 DOM 对象,此对象可执行拥有指定特性和版本的专门的 API。     No Yes
getUserData(key) 返回关联节点上键的对象。此对象必须首先通过使用相同的键来调用 setUserData 来设置到此节点。     No Yes
hasAttribute() 返回元素是否拥有指定的属性。 5 1 9 Yes
hasAttributeNS() 返回元素是否拥有指定的属性。 No 1 9 Yes
hasAttributes() 返回元素是否拥有属性。 5 1 9 Yes
hasChildNodes() 返回元素是否拥有子节点。 5 1 9 Yes
insertBefore() 在已有的子节点之前插入一个新的子节点。 5 1 9 Yes
isDefaultNamespace(URI) 返回指定的命名空间 URI 是否为默认。     No Yes
isEqualNode() 检查两节点是否相等。 No No No Yes
isSameNode() 检查两节点是否为同一节点。 No 1 No Yes
isSupported(feature,version) 返回指定的特性是否在此元素上得到支持。     9 Yes
lookupNamespaceURI() 返回匹配指定前缀的命名空间 URI。 No 1 No Yes
lookupPrefix() 返回匹配指定的命名空间 URI 的前缀。 No 1 No Yes
normalize()   5 1 9 Yes
removeAttribute() 删除指定的属性。 5 1 9 Yes
removeAttributeNS() 删除指定的属性。 No 1 9 Yes
removeAttributeNode() 删除指定的属性节点。 5 1 9 Yes
removeChild() 删除子节点。 5 1 9 Yes
replaceChild() 替换子节点。 5 1 9 Yes
setUserData(key,data,handler) 把对象关联到元素上的键。     No Yes
setAttribute() 添加新属性。 5 1 9 Yes
setAttributeNS() 添加新属性。   1 9 Yes
setAttributeNode() 添加新的属性节点。 5 1 9 Yes
setAttributeNodeNS(attrnode) 添加新的属性节点。     9 Yes
setIdAttribute(name,isId) 如果 Attribute 对象 isId 属性为 true,那么此方法会把指定的属性声明为一个用户确定 ID 的属性(user-determined ID attribute)。     No Yes
setIdAttributeNS(uri,name,isId) 如果 Attribute 对象 isId 属性为 true,那么此方法会把指定的属性声明为一个用户确定 ID 的属性(user-determined ID attribute)(带有命名空间)。     No Yes
setIdAttributeNode(idAttr,isId) 如果 Attribute 对象 isId 属性为 true,那么此方法会把指定的属性声明为一个用户确定 ID 的属性(user-determined ID attribute)。     No Yes