diff --git a/source b/source index 06293766f70..9742b95a5e2 100644 --- a/source +++ b/source @@ -7142,11 +7142,9 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d

The HTMLAllCollection interface is used for the legacy document.all attribute. It operates similarly to - HTMLCollection; the main differences are that its namedItem() method returns an - HTMLCollection object when there are multiple matching elements, and that its item() method can be used as a synonym for its namedItem() method.

+ HTMLCollection; the main differences are that it allows a staggering variety of + different (ab)uses of its methods to all end up returning something, and that it can be called as + a function as an alternative to property access.

All HTMLAllCollection objects are rooted at a Document and have a filter that matches all elements, so the elements represented by the @@ -7156,9 +7154,9 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d

[LegacyUnenumerableNamedProperties]
 interface HTMLAllCollection {
   readonly attribute unsigned long length;
-  getter Element? item(unsigned long index);
-  (HTMLCollection or Element)? item(DOMString name);
-  legacycaller getter (HTMLCollection or Element)? namedItem(DOMString name);
+  getter Element? (unsigned long index);
+  getter (HTMLCollection or Element)? namedItem(DOMString name);
+  legacycaller (HTMLCollection or Element)? item(optional DOMString nameOrIndex);
 };
@@ -7169,13 +7167,14 @@ interface HTMLAllCollection {
element = collection . item(index)
+
element = collection(index)
element = collection[index]
-

Returns the item with index index from the collection. The items are sorted in tree order.

+

Returns the item with index index from the collection (determined by tree order).

-
element = collection . item(name)
-
collection = collection . item(name)
+
element = collection . item(name)
+
collection = collection . item(name)
element = collection . namedItem(name)
collection = collection . namedItem(name)
element = collection(name)
@@ -7199,6 +7198,43 @@ interface HTMLAllCollection {

The object's supported property indices are as defined for HTMLCollection objects.

+

The supported property names consist of the non-empty values of all the id attributes of all the elements represented by the + collection, and the non-empty values of all the name attributes of + all the "all"-named elements represented by the collection, in + tree order, ignoring later duplicates, with the id of + an element preceding its name if it contributes both, they differ from each + other, and neither is the duplicate of an earlier entry.

+ +

On getting, the length + attribute must return the number of nodes represented by the collection.

+ +

The indexed property getter must return the result of getting the "all"-indexed element from this + HTMLAllCollection given the passed index.

+ +

The namedItem(name) + method must return the result of getting the "all"-named + element(s) from this HTMLAllCollection given name.

+ +

The item(nameOrIndex) + method (and the legacycaller behavior) must run the following steps:

+ +
    +
  1. If nameOrIndex was not provided, return null.

  2. + +
  3. If nameOrIndex, converted to a + JavaScript string value, is an array index property name, return the result of getting the "all"-indexed element from this + HTMLAllCollection given the number represented by nameOrIndex.

  4. + +
  5. Return the result of getting the "all"-named + element(s) from this HTMLAllCollection given + nameOrIndex.

  6. +
+ +
+

The following elements are "all"-named elements: a, @@ -7219,53 +7255,37 @@ interface HTMLAllCollection { textarea

-

The supported property names consist of the non-empty values of all the id attributes of all the elements represented by the - collection, and the non-empty values of all the name attributes of - all the "all"-named elements represented by the collection, in - tree order, ignoring later duplicates, with the id of - an element preceding its name if it contributes both, they differ from each - other, and neither is the duplicate of an earlier entry.

- -

On getting, the length - attribute must return the number of nodes represented by the collection.

+

To get the "all"-indexed element from an + HTMLAllCollection collection given an index index, return the + indexth element in collection, or null if there is no such + indexth element.

-

The item(index) method - must return the indexth element in the collection. If there is no - indexth element in the collection, - then the method must return null.

- -

The item(name) and namedItem(name) - methods must act according to the following algorithm:

+

To get the "all"-named element(s) from an + HTMLAllCollection collection given a name name, perform the + following steps:

    - -
  1. If name is the empty string, return null and stop the algorithm.
  2. +
  3. If name is the empty string, return null.

  4. - -

    Let collection be an HTMLCollection object rooted at the - same Document as the HTMLAllCollection object on which the method was - invoked, whose filter matches only elements that are either:

    +

    Let subCollection be an HTMLCollection object rooted at the same + Document as collection, whose filter matches only elements that are + either:

      +
    • "all"-named elements with a name attribute equal to + name, or,

    • -
    • "all"-named elements with a name attribute equal to - name, or,
    • - -
    • elements with an ID equal to name.
    • - +
    • elements with an ID equal to name.

    -
  5. -
  6. If, at the time the method is called, there is exactly one node in collection, then return that node and stop the algorithm.
  7. - -
  8. Otherwise, if, at the time the method is called, collection is empty, - return null and stop the algorithm.
  9. +
  10. If there is exactly one element in subCollection, then return that + element.

  11. -
  12. Otherwise, return collection.
  13. +
  14. Otherwise, if subCollection is empty, return null.

  15. +
  16. Otherwise, return subCollection.

@@ -117160,6 +117180,7 @@ INSERT INTERFACES HERE Anthony Boyd, Anthony Bryan, Anthony Hickson, + Anthony Ramine, Anthony Ricaud, Antti Koivisto, Arkadiusz Michalski,