Attr Interface

The Attr interface represents an attribute in an Element object. Typically the allowable values are defined in a document type definition.



IDL Definition

Interface Attr : Node {

        readonly  attribute  DomString    name
        readonly  attribute  boolean      specified
        readonly  attribute  DomString    value
};

Semantic Requirements

  1. <Attr> objects are not consider to be children of the element, therefore the parentNode, previousSibling and nextSibling attributes have a null value for <Attr> objects.
  2. <Attr> objects may be associated with Element nodes contained within a DocumentFragment.
  3. If an <Attr> is explicitly assigned any value, then that value is the attribute's effective value.
  4. If there is no explicit value assigned to this attribute and there is a declaration for this attribute and that declaration includes a default value, then that default value is the Attribute's default value.
  5. Attributes

  6. The name attribute returns the name of this Attribute node.
  7. The specified attribute is set to true if the attribute was explicitly given a value in the original document, otherwise it is set to false.
  8. If the user changes the value of the attribute (even if changed to the default value), then the specified attribute is flipped to true.
  9. To reset an attribute to its default value (from the DTD), the attribute must be deleted. The implementation will then make a new attribute with the specified attribute set to false and its default value (if one was given).
  10. The value attribute contains the value of the Attribute node as a string (on retrieval). Character and general entity references are replaced with their values.
  11. On setting the value attribute creates a Text node with the unparsed content of the string.
  12. DOMExceptions

  13. Setting the value attribute raises a NO_MODIFICATION_ALLOWED_ERR DOMException when the node is readonly.

If you have comments or suggestions, email me at mbrady@nist.gov