diff --git a/source b/source index 81cbb67d3b0..8bb5737ea83 100644 --- a/source +++ b/source @@ -2714,6 +2714,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
DOMTokenList
object whose associated element is the element in question and
whose associated attribute's local name is the name of the attribute in question.
-
+ If a reflecting IDL attribute attr has the type T?
, where T is either Element
or an
+ interface that inherits from Element
, then:
+
+
Elements of the type this IDL attribute appears on have an explicitly set + attr-element, which is an element or null. It is initially null.
Elements of the type this IDL attribute appears on have an attr-associated + element. To compute the attr-associated element for such an + element element:
+ +If element's explicitly set attr-element is not null:
+If element's explicitly set attr-element is a + descendant of any of element's shadow-including ancestors, then return + element's explicitly set attr-element.
Otherwise, return null.
Otherwise, if the content attribute is present on element, then return the first + element candidate, in tree order, that meets the following + criteria:
+ +If no such element exists, then return null.
+Return null.
Other parts of this specification, or other specifications using attribute + reflection, are generally expected to consult the attr-associated + element. The explicitly set attr-element is an internal + implementation detail of the attr-associated element, and is not to be + used directly.
+On getting, the IDL attribute must return this element's attr-associated + element.
On setting, the IDL attribute must perform the following steps:
+Let id be the empty string.
If the given value:
+id
attribute, andid
+ attribute,then set id to the given value's ID.
+ +Set the content attribute's value for this element to id.
Set this element's explicitly set attr-element to the given + value.
The following attribute change + steps are used to synchronize between the content attribute and the IDL attribute:
+If localName is not the content attribute's local name, or + namespace is not null, then return.
Set element's explicitly set attr-element to + null.
If a reflecting IDL attribute attr has the type FrozenArray<T>?
, where T is either
+ Element
or an interface that inherits from Element
, then:
Elements of the type this IDL attribute appears on have explicitly set + attr-elements, which is either a list of elements or null. It is + initially null.
Elements of the type this IDL attribute appears on have cached
+ attr-associated elements, which is a FrozenArray<
. It is initially null.Element
>?
Elements of the type this IDL attribute appears on have attr-associated elements. To compute the + attr-associated elements for such an element element:
+ +Let elements be an empty list.
If element's explicitly set attr-elements is not + null, then:
+For each attrElement in the element's + explicitly set attr-elements:
+If attrElement is not a descendant of any of element's shadow-including ancestors, then + continue.
Add attrElement to elements.
Otherwise:
+If the content attribute is not present on element, return null.
Let tokens be the content attribute's value, split on ASCII whitespace. + +
For each id in tokens:
+Let candidate be the first element, in tree order, that meets the + following criteria:
+ +If no such element exists, then continue.
+Append candidate to + elements.
Return elements.
Other parts of this specification, or other specifications using attribute + reflection, are generally expected to consult the attr-associated + elements. The explicitly set attr-elements are an internal + implementation detail of the attr-associated elements, and are not to be + used directly. Similarly, the cached attr-associated elements are an + internal implementation detail of the IDL attribute's getter.
+On getting, the IDL attribute must perform the following steps:
+ +Let elements be this element's attr-associated + elements.
If the contents of elements is equal to the contents of this element's + cached attr-associated elements, then return this element's + cached attr-associated elements.
Let elementsAsFrozenArray be elements, converted to a FrozenArray<T>?
.
Set this element's cached attr-associated elements to + elementsAsFrozenArray.
Return elementsAsFrozenArray.
This extra caching layer is necessary to preserve the invariant that element.reflectedElements === element.reflectedElements
.
On setting, the IDL attribute must perform the following steps:
+If the given value is null:
+Set this element's explicitly set attr-elements to + null.
Remove the content attribute from this element.
Return.
Let value be an empty string.
For each element in the given value:
+If value is empty and elements is non-empty, then append element to elements and + continue.
Append element to + elements.
If element:
+ +id
attribute, orid
+ attribute,then set value to the empty string, and continue.
+Let id be element's ID.
If value is not the empty string, then append U+0020 SPACE to + value.
Append id to value.
Set the content attribute's value for this element to value.
Set this element's explicitly set attr-elements to + elements.
The following attribute change + steps are used to synchronize between the content attribute and the IDL attribute:
+If localName is not the content attribute's local name, or + namespace is not null, then return.
Set element's explicitly set attr-elements to + null.