📜  DOM-属性对象

📅  最后修改于: 2020-11-10 05:14:02             🧑  作者: Mango


Attr接口表示Element对象中的属性。通常,属性的允许值是在与文档关联的架构中定义的。 Attr对象实际上不是它们描述的元素的子节点,因此不被视为文档树的一部分。因此,对于子节点parentNodepreviousSiblingnextSibling属性值为null

属性

下表列出了Attribute对象的属性

Attribute Type Description
name DOMString This gives the name of the attribute.
specified boolean It is a boolean value which returns true if the attribute value exists in the document.
value DOMString Returns the value of the attribute.
ownerElement Element It gives the node to which attribute is associated or null if attribute is not in use.
isId boolean It returns whether the attribute is known to be of type ID (i.e. to contain an identifier for its owner element) or not.