diff --git a/source b/source index dd6fd7f9d5d..e3b852a80fb 100644 --- a/source +++ b/source @@ -7312,58 +7312,67 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute

If a reflecting IDL attribute has the type HTMLElement, or an interface that descends from HTMLElement, then it must be paired with another reflecting IDL attribute - that has the type DOMString. + that has the type DOMString?. The relationship between these two attributes is as follows:

  1. The attribute which has the type HTMLElement should be named attrElement, - where the paired DOMString attribute is named + where the paired nullable DOMString attribute is named attr.
  2. -
  3. On getting the attr attribute, - the IDL attribute must return the value of the content attribute as normal.
  4. +
  5. On getting attr attribute, + the IDL attribute must return the value of the content attribute, + or null if the content attribute does not exist on the element.
  6. -
  7. On getting the attrElement attribute, - it must run the following algorithm - (stopping at the first point where a value is returned):
  8. -
      -
    1. If the content attribute corresponding to attr - is absent, then the IDL attribute attrElement must return null.
    2. - -
    3. Let candidate be the element that the - document.getElementById() method - would find when called on the content attribute's element's node document - if it were passed as its argument the current value - of the corresponding content attribute.
    4. - -
    5. If candidate is null, or if it is not type-compatible with the IDL attribute, - then the IDL attribute must return null.
    6. +
    7. On getting the attrElement IDL attribute, + it must return the value previously set for attrElement, + or null if the value was not previously set or was deleted. +
    8. -
    9. Otherwise, it must return candidate.
    10. -
  9. On setting the attr attribute, - the content attribute must be set to the specified value.
  10. + it must run the following algorithm: +
      +
    1. If the specified value is different from the previous value of the content attribute, + the stored value, if any, for attrElement + should be deleted. +
    2. If the specified value is null, the content attribute must be removed, + and the algorithm terminated. +
    3. Otherwise, the content attribute must be set to the specified value. +
    4. If the specified value is not a valid value for the + id attribute, + the algorithm is terminated. +
    5. Otherwise, let candidate be the element that the + document.getElementById() method + would find when called on the content attribute's element's node tree's + root if it were passed as its argument the current value + of the corresponding content attribute.
    6. +
    7. If candidate is not null, and it is type-compatible with the + attrElement IDL attribute, + store candidate as the value for the + attrElement IDL attribute. +
    8. +
    +
  11. On setting the attrElement attribute, it must run the following algorithm:
    1. -
    2. Let id be the empty string.
    3. +
    4. If the given element is not in the element's node tree, + or its light tree if it exists, + or is not type-compatible with the IDL attribute, + then remove the attr and return. +
    5. Otherwise, let id be the empty string.
    6. If the given element has an id attribute, and has the same tree as the element of the attribute being set, and the given element is the first element in that tree whose ID is the value of that id attribute, - then let id be the value of that id attribute. -
    7. Set the attr content attribute to id. + then let id be the value of that id attribute.
    8. +
    9. Set the attr content attribute to id.
-

If a reflecting IDL attribute has the type sequence<Element>, - or sequence<T> where T descends from Element...

- -

TODO

-

Collections

@@ -43276,7 +43285,8 @@ interface HTMLFormElement : HTMLElement { HTMLConstructor] interface HTMLLabelElement : HTMLElement { readonly attribute HTMLFormElement? form; - [CEReactions] attribute DOMString htmlFor; + [CEReactions] attribute HTMLElement? htmlForElement; + [CEReactions] attribute DOMString? htmlFor; readonly attribute HTMLElement? control; }; @@ -43295,23 +43305,19 @@ interface HTMLLabelElement : HTMLElement { labeled control.

- -

The for attribute may be specified to indicate a - form control with which the caption is to be associated. If the attribute is specified, the - attribute's value must be the ID of a labelable element in the same tree as the - label element. If the attribute is specified and there is an - element in the tree whose ID is equal to the value - of the for attribute, and the first such element in - tree order is a labelable element, then that - element is the label element's labeled control.

+

The htmlForElement IDL attribute + may be specified to indicate a + form control with which the caption is to be associated. + If the attribute is specified, the attribute's value must be a + labelable element. +

-

If the for attribute is not specified, but the - label element has a labelable element descendant, - then the first such descendant in tree order is the label element's - labeled control.

+

If the htmlForElement IDL attribute is not specified, but + the label element has a labelable element + descendant, then the first such descendant in tree order is the label + element's labeled control.

The label element's exact default presentation and behavior, in particular what its activation behavior might be, if anything, should match the platform's label @@ -43375,8 +43381,9 @@ interface HTMLLabelElement : HTMLElement {

-

The htmlFor IDL attribute must - reflect the for content attribute.

+

The paired htmlFor and + htmlForElement IDL attributes must + reflect the for content attribute.

The control IDL attribute must return the label element's labeled control, if any, or null if there isn't one.