diff --git a/source b/source index 2994434c3e8..e80933d0f8e 100644 --- a/source +++ b/source @@ -8413,8 +8413,9 @@ interface HTMLOptionsCollection : HTMLCollectionWhen set to a smaller number than the existing length, truncates the number of option elements in the container corresponding to collection.

-

When set to a greater number than the existing length, adds new blank option - elements to the container corresponding to collection.

+

When set to a greater number than the existing length, if that number is less than or equal + to 10000, adds new blank option elements to the container corresponding to + collection.

element = collection.item(index)
@@ -8478,13 +8479,37 @@ interface HTMLOptionsCollection : HTMLCollectionlength attribute must return the number of nodes represented by the collection.

-

On setting, the behavior depends on whether the new value is equal to, greater than, or less - than the number of nodes represented by the collection at that time. If the number is - the same, then setting the attribute must do nothing. If the new value is greater, then n new option elements with no attributes and no child nodes must be - appended to the select element on which the HTMLOptionsCollection is - rooted, where n is the difference between the two numbers (new value minus old - value). Mutation events must be fired as if a DocumentFragment containing the new - option elements had been inserted. If the new value is lower, then the last n nodes in the collection must be removed from their parent nodes, where n is the difference between the two numbers (old value minus new value).

+

On setting to a new value value, the user agent must run the following algorithm:

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

  2. + +
  3. +

    If value is greater than current, then:

    + +
      +
    1. If value is greater than 10000, then abort these steps.

    2. + +
    3. Let n be value - current.

    4. + +
    5. Append n new option elements with no attributes and no child + nodes to the select element on which the HTMLOptionsCollection is + rooted. Mutation events must be fired as if a DocumentFragment containing the new + option elements had been inserted.

    6. +
    +
  4. + +
  5. +

    If value is less than current, then:

    + +
      +
    1. Let n be current - value.

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

    4. +
    +
  6. +

Setting length never removes or adds any optgroup elements, and never adds new children to existing