diff --git a/sections/nodes.include b/sections/nodes.include index 3cf1a4ce6..91add8245 100644 --- a/sections/nodes.include +++ b/sections/nodes.include @@ -2224,6 +2224,28 @@ interface Element : Node {

Applicable specifications and this specification (can) use the hooks an attribute is set, an attribute is changed, an attribute is added, and an attribute is removed, for further processing of the attribute's value. +To replace an +attribute oldAttr by an attribute newAttr +in an element element, run these steps: + +

    +
  1. Queue a mutation record of "attributes" for element + with name oldAttr's local name, + namespace oldAttr's namespace, + and oldValue oldAttr's value. + +

  2. Run the attribute change steps with element, oldAttr's + local name, oldAttr's value, newAttr's + value, and oldAttr's namespace. + +

  3. Replace oldAttr by newAttr in the element's + attribute list. + +

  4. Set oldAttr's element to null. + +

  5. Set newAttr's element to element. +

+ To get an attribute by name given a qualifiedName and element element, run these steps: @@ -2264,6 +2286,28 @@ run these steps:
  • Return attr's value.

  • +To set an attribute given an +attr and element, run these steps: + +
      +
    1. If attr's element is neither null nor element, + throw an {{InUseAttributeError}}. + +

    2. Let oldAttr be the result of + getting an attribute given + attr's namespace, attr's local name, and + element. + +

    3. If oldAttr is attr, return attr. + +

    4. If oldAttr is non-null, replace it + by attr in element. + +

    5. Otherwise, append attr to element. + +

    6. Return oldAttr. +

    +

    To set an attribute value for an element element using a localName and value, and an optional prefix, and an optional namespace, run these steps: @@ -2429,7 +2473,7 @@ must run these steps:


    -

    The attributes attribute must return a NamedNodeMap. +

    The attributes attribute must return a {{{NamedNodeMap}}}.

    The getAttribute(qualifiedName) method must run these steps: @@ -2508,6 +2552,123 @@ method, when invoked, must remove an attribu

    The getElementsByClassName(classNames) method must return the list of elements with class names classNames for the context object. +

    Interface {{NamedNodeMap}}

    + +
    +[Exposed=Window, LegacyUnenumerableNamedProperties]
    +interface NamedNodeMap {
    +  readonly attribute unsigned long length;
    +  getter Attr? item(unsigned long index);
    +  getter Attr? getNamedItem(DOMString qualifiedName);
    +  Attr? getNamedItemNS(DOMString? namespace, DOMString localName);
    +  Attr? setNamedItem(Attr attr);
    +  Attr? setNamedItemNS(Attr attr);
    +  Attr removeNamedItem(DOMString qualifiedName);
    +  Attr removeNamedItemNS(DOMString? namespace, DOMString localName);
    +};
    +
    + +A {{NamedNodeMap}} has an associated +element (an +element). + +A {{NamedNodeMap}} object's +attribute list is its +element's +attribute list. + +
    + +A {{NamedNodeMap}} object's +supported property indices are the numbers in the +range zero to the number of attributes in its +attribute list map minus one, unless the +attribute list is empty, in which case +there are no supported property indices. + +

    The length attribute's getter must return +the number of attributes in the attribute list. + +

    The item(index) method, when +invoked, must run these steps: + +

      +
    1. If index is equal to or greater than the number of attributes in the + attribute list, return null. + +

    2. Otherwise, return the indexth attribute in the + attribute list. +

    + +

    A {{NamedNodeMap}} object's supported property names are the return value of running these +steps: + +

      +
    1. Let names be the qualified names of the attributes in this + {{NamedNodeMap}} object's attribute list, with duplicates omitted, in + order. + + +

    2. +

      If this {{NamedNodeMap}} object's element is in the + HTML namespace and its node document is an HTML document, then for + each name in names, run these substeps: + +

        +
      1. Let lowercaseName be name, in ASCII lowercase. + +

      2. If lowercaseName is not equal to name, remove name from + names. +

      + +
    3. Return names. +

    + +

    The getNamedItem(qualifiedName) +method, when invoked, must return the result of +getting an attribute given qualifiedName and +element. + +

    The +getNamedItemNS(namespace, localName) +method, when invoked, must return the result of +getting an attribute given +namespace, localName, and +element. + +

    The setNamedItem(attr) and +setNamedItemNS(attr) +methods, when invoked, must return the result of setting an attribute given attr and element. Rethrow any exceptions. + +

    The removeNamedItem(qualifiedName) +method, when invoked, must run these steps: + +

      +
    1. Let attr be the result of + removing an attribute given + qualifiedName and element. + +

    2. If attr is null, then throw a {{NotFoundError}}. + +

    3. Return attr. +

    + +

    The +removeNamedItemNS(namespace, localName) +method, when invoked, must run these steps: + +

      +
    1. Let attr be the result of + removing an attribute given + namespace, localName, and element. + +

    2. If attr is null, then throw a {{NotFoundError}}. + +

    3. Return attr. +

    +

    Interface Attr

     [Exposed=Window]