diff --git a/source b/source index d928222a11e..62cdd5a2644 100644 --- a/source +++ b/source @@ -3289,7 +3289,8 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
  • HTMLCollection interface, its length attribute, and its item() and - namedItem() methods
  • + namedItem() methods, and its + find a named element algorithm
  • The terms collection and represented by the collection
  • DOMTokenList interface, and its @@ -9971,37 +9972,45 @@ interface HTMLOptionsCollection : HTMLCollection
    -

    The length setter steps are:

    +

    To set the number of options of a select element select to a + value value:

      -
    1. Let current be the number of nodes represented by the - collection.

    2. +
    3. Let current be the size of select's + list of options.

    4. -

      If the given value is greater than current:

      +

      If value is greater than current:

        -
      1. If the given value is greater than 100,000, then return.

      2. +
      3. If value is greater than 100,000, then return.

      4. Let n be valuecurrent.

      5. -
      6. Append new option elements to the select element on which - this is rooted given n.

      7. +
      8. Append new option elements to select given + n.

    5. -

      If the given value is less than current:

      +

      If value is less than current:

      1. Let n be currentvalue.

      2. -
      3. Remove the last n nodes in the collection from their parent nodes.

      4. +
      5. Remove the last n nodes in select's list of options from their parent nodes.

    +
    +

    The length setter steps are to + set the number of options of the select element on which + this is rooted to the given value.

    +
    +

    Setting length never removes or adds any optgroup elements, and never adds new children to existing optgroup elements (though it can remove children from them).

    @@ -10031,56 +10040,60 @@ interface HTMLOptionsCollection : HTMLCollection
    -

    To set the value of a new indexed property - or set the value of an existing indexed property for an - HTMLOptionsCollection collection, given a property index index - and a new value value:

    +

    To set the value of an option in a select element select, + given a property index index and a new value value:

    1. If value is null, then remove - an option from collection given index and return.

    2. + an option from select given index and return.

      -
    3. Let length be the number of nodes represented by collection.

    4. +
    5. Let length be the size of select's + list of options.

    6. Let delta be indexlength.

    7. If delta is greater than 0, then append new option elements to - the select element on which collection is rooted given - delta.

    8. + select given delta.

    9. If delta is greater than or equal to 0, then append value to the select element - on which collection is rooted. Otherwise, replace the indexth element in - collection by value.

    10. + data-x="concept-node-append">append value to select. Otherwise, + replace the indexth element in + select's list of options by + value.

    -

    The add(element, before) - method steps are:

    +

    To set the value of a new indexed property + or set the value of an existing indexed property for an + HTMLOptionsCollection collection, given a property index index + and a new value value, set the value of an option in the select + element on which collection is rooted, given index and value.

    +
    + +
    +

    To add an element element to a + select element select given a before:

      -
    1. If element is an ancestor of the select element on which - this is rooted, then throw a "HierarchyRequestError" - DOMException.

    2. +
    3. If element is an ancestor of select, then throw a + "HierarchyRequestError" DOMException.

    4. -
    5. If before is an element, but that element isn't a descendant of the - select element on which this is rooted, then throw a - "NotFoundError" DOMException.

    6. +
    7. If before is an element, but that element isn't a descendant of + select, then throw a "NotFoundError" + DOMException.

    8. If element and before are the same element, then return.

    9. Let reference be null.

    10. If before is a node, then set reference to before. - Otherwise, if before is an integer and there is a beforeth node in - this, then set reference to that node.

    11. + Otherwise, if before is an integer and there is a beforeth element in + select's list of options, then set + reference to that element.

    12. Let parent be reference's parent node if reference is - not null; otherwise the select element on which this is rooted.

    13. + not null; otherwise select.

    14. Pre-insert element into parent node before reference.

    15. @@ -10088,16 +10101,23 @@ interface HTMLOptionsCollection : HTMLCollection
      -

      To remove an option from an - HTMLOptionsCollection collection given an integer index:

      +

      The add(element, before) + method steps are to add element to the + select element on which this is rooted given before.

      +
      + +
      +

      To remove an option from a + select element select given an integer index:

        -
      1. If the number of nodes represented by - collection is 0, then return.

      2. +
      3. If the size of select's list of options is 0, then return.

      4. -
      5. If index is not a number greater than or equal to 0 and less than the number - of nodes represented by collection, - then return.

      6. +
      7. If index is not a number greater than or equal to 0 and less than the size of select's list of options, then return.

      8. @@ -10111,8 +10131,8 @@ interface HTMLOptionsCollection : HTMLCollection -
      9. Let element be the indexth element in - collection.

      10. +
      11. Let element be the indexth element in select's list of options.

      12. Remove element from its parent node.

      @@ -10121,8 +10141,8 @@ interface HTMLOptionsCollection : HTMLCollection

      The remove(index) method steps are - to remove an option from - this given index.

      + to remove an option from the + select element on which this is rooted given index.

      @@ -57668,79 +57688,82 @@ interface HTMLSelectElement : HTMLElement {
      -

      The type IDL - attribute, on getting, must return the string "select-one" if the multiple attribute is absent, and the string "select-multiple" if the multiple - attribute is present.

      +

      The type + getter steps are to return "select-one" if this's multiple attribute is absent; otherwise "select-multiple".

      The options IDL attribute must return an - HTMLOptionsCollection rooted at the select node, whose filter matches - the elements in the list of options.

      + data-x="dom-select-options">options getter steps are to return an + HTMLOptionsCollection rooted at this, whose filter matches the elements + in the list of options.

      +
      + +
      +

      A select element's supported property indices are the numbers in the + range 0 to one less than its list of options's + size. If its list of + options is empty, then there are no supported + property indices.

      -

      The options collection is also mirrored on the - HTMLSelectElement object. The supported property indices at any instant - are the indices supported by the object returned by the options attribute at that instant.

      +

      The length getter steps are to return the size of this's list of options.

      -

      The length - IDL attribute must return the number of nodes represented by the options collection. - On setting, it must act like the attribute of the same name on the options collection.

      +

      The length setter steps are to set the number of + options of this to the given value.

      The item(index) method must return the value returned - by the method of the same name on the options collection, when invoked with the same argument.

      + data-x="dom-select-item">item(index) method steps are to return the + indexth element in this's list + of options, or null if there is no such element.

      The namedItem(name) method must return the value - returned by the method of the same name on the - options collection, when invoked with the same - argument.

      + data-x="dom-select-namedItem">namedItem(name) method steps are to find a named element in this's list of options given name.

      -

      When the user agent is to set the value of a new indexed - property or set the value of an existing indexed property for a - select element, it must instead run the - corresponding algorithm on the select element's options collection.

      +

      To set the value of a new indexed property or set the + value of an existing indexed property for a select element select, + given a property index index and a new value value, set the value of + an option in select given index and value.

      -

      Similarly, the add(element, before) method must act - like its namesake method on that same options - collection.

      +

      The add(element, before) method steps are + to add element to this given + before.

      The remove() - method must act like its namesake method on that same options collection when it has arguments, and like its namesake - method on the ChildNode interface implemented by the HTMLSelectElement - ancestor interface Element when it has no arguments.

      + method steps are to remove an option + from this given the argument when the method has arguments, and to act like the + identically named method on the ChildNode interface implemented by the + HTMLSelectElement ancestor interface Element when it has no + arguments.

      The selectedOptions IDL attribute must return an - HTMLCollection rooted at the select node, whose filter matches the - elements in the list of options that have their - selectedness set to true.

      + data-x="dom-select-selectedOptions">selectedOptions getter steps are to return an + HTMLCollection rooted at this, whose filter matches the elements in the + list of options that have their selectedness set to true.

      A select element's selected index is