diff --git a/source b/source index 904af003371..c3cdae6aeeb 100644 --- a/source +++ b/source @@ -3198,7 +3198,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
HTMLCollection
interface, its
length
attribute, and its
@@ -5192,6 +5192,239 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
+ + Element reference attributes refer to one or more Elements in the document. When specified + as content attributes, element reference attributes refer to other Elements + via their IDs. + +
The steps to resolve the reference + target on an element element are:
+ +If element does not have a shadow root, or element's + shadow root's reference target is null, return element.
+Let referenceTarget be the value of element's shadow + root's reference target.
Let candidate be the first element in element's shadow + root whose ID matches referenceTarget.
+If no such element exists, return null.
Return the result of resolving the reference + target on candidate. +
A single element reference attribute represents a reference to a single element. + When specified as a content attribute, a single element reference consists of a + single token which should completely match the ID of another + element in the document.
+ +A single element reference attribute attr on an element X + refers to an element Y + if Y is the attr-associated + element for X.
+ +The rules to get the + attr-associated element for a single element reference attribute + attr and element element, are:
+ +If the attribute is not specified on element, return null.
If element has an explicitly-set + attr-element which is not null:
+ +If element's explicitly-set + attr-element is a descendant of any of element's + shadow-including ancestors, then let + candidate be element's + explicitly-set attr-element.
+Otherwise, let candidate be null.
An element will only have an
+ explicitly-set attr-element if it has
+ an IDL attribute with a type derived from Element
which
+ reflects attr.
Otherwise: + +
Let value be the attribute value.
Let candidate be the first element in element's tree, + in tree order whose ID is value.
+If no such element exists, let candidate be null.
+Return the result of resolving the reference + target on candidate. +
A label
element can use the for
attribute to
+ create an association with an input
element:
<label for="name">Name:</label>
+<input id="name">
+
+ In this example, the input
element is the
+ for
-associated element for the label
+ element.
An element with a shadow root may use a reference target to allow + attr-association to be created with an element inside of its shadow root: + +
<label for="name">Name:</label>
+<fancy-input id="name">
+ <template shadowrootmode="closed"
+ shadowrootreferencetarget="real-input">
+ <input id="real-input">
+ </template>
+</fancy-input>
+
+
+ In this second example, the input
inside of the shadow root is the
+ for
-associated element.
A set of element references attribute represents + a set of references to elements. When specified as a content attribute, a set of element + references consists of a set of space-separated tokens, each of which should + completely match the ID of another element in the document.
+ +An unordered set of unique element + references is a set of element references where none of the element references + is repeated.
+ +An ordered set of unique element + references is a set of element references where none of the element references + is repeated, and the order of the elements is meaningful.
+ +A set of element references attribute attr on an element X + refers to an element Y + if Y is one of the + attr-associated elements for + X.
+ +The rules to get the attr-associated elements for a set of + element references attribute attr and element element are:
+ +If the attribute is not specified on element, return null.
Let candidates be an empty list.
If element's has an explicitly set attr-elements which + is not null:
+ +For each attrElement in + reflectedTarget's explicitly set attr-elements:
+ +If attrElement is not a descendant of any of + element's shadow-including + ancestors, then continue.
Append attrElement to + candidates.
An element will only have
+ explicitly-set attr-elements if it
+ has an IDL attribute with type FrozenArray<T>?
, where T is either
+ Element
or an interface that inherits from Element
, which
+ reflects attr.
Otherwise:
+ +Let value be the attribute value.
Let tokens be value, split on ASCII whitespace. + +
For each id of tokens:
+ +Let candidate be the first element, in tree order, that meets + the following criteria:
+ +candidate's root is the same as element's + root; and
candidate's ID is id.
+If no such element exists, then continue.
+Append candidate to + candidates.
Let resolvedCandidates be an empty list.
For each candidate in candidates: +
+ +Let resolvedCandidate be the result of + resolving the reference target on + candidate.
If resolvedCandidate is not null, append resolvedCandidate to + resolvedCandidates.
Return resolvedCandidates.
If a reflected IDL attribute has the type T?
,
- where T is either Element
or an interface that inherits from
- Element
, then with attr being the reflected content attribute
- name:
If a reflected IDL attribute has the type Element
, then with
+ attr being the reflected content attribute name:
Its reflected target has an explicitly set - attr-element, which is a weak reference to an element or null. It is initially - null.
Its reflected target has an + explicitly set attr-element, which is a weak reference to an element or null. + It is initially null.
Its reflected target reflectedTarget has a get the - attr-associated element algorithm, that runs these steps:
+The getter steps are:
Let element be the result of running reflectedTarget's get - the element.
Let contentAttributeValue be the result of running - reflectedTarget's get the content attribute.
If reflectedTarget's explicitly set attr-element is not - null:
- -If reflectedTarget's explicitly set attr-element is - a descendant of any of element's shadow-including ancestors, then return - reflectedTarget's explicitly set attr-element.
Return null.
Otherwise, if contentAttributeValue is not null, return the first element - candidate, in tree order, that meets the following criteria:
- -candidate's root is the same as element's - root;
candidate's ID is - contentAttributeValue; and
candidate implements T.
If no such element exists, then return null.
+Let candidate be the result of running this's + get the attr-associated + element.
Return null.
Return the result of retargeting candidate + against this.
The getter steps are to return the result of running this's get the - attr-associated element.
The setter steps are:
If a reflected IDL attribute has the type FrozenArray<T>?
, where T is either
- Element
or an interface that inherits from Element
, then with
- attr being the reflected content attribute name:
Its reflected target has an explicitly set @@ -8642,102 +8836,39 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute elements, which is a list of elements. It is initially « ».
Its reflected target has a cached attr-associated
- elements object, which is a FrozenArray<T>?
. It is
+ elements object, which is a FrozenArray<Element>?
. It is
initially null.
Its reflected target reflectedTarget has a get the - attr-associated elements algorithm, which runs these steps:
+The getter steps are:
Let elements be an empty list.
Let element be the result of running reflectedTarget's get - the element.
If reflectedTarget's explicitly set attr-elements is not - null:
- -For each attrElement in - reflectedTarget's explicitly set attr-elements:
- -If attrElement is not a descendant of any of - element's shadow-including - ancestors, then continue.
Let elements be the result of running this's get the + attr-associated elements.
Append attrElement to - elements.
Let retargetedElements be an empty list.
Otherwise:
+For each element in elements:
Let contentAttributeValue be the result of running - reflectedTarget's get the content attribute. - -
If contentAttributeValue is null, then return null.
Let tokens be contentAttributeValue, split on ASCII whitespace. - -
For each id of tokens:
- -Let candidate be the first element, in tree order, that meets - the following criteria:
- -candidate's root is the same as element's - root;
candidate's ID is id; - and
candidate implements T.
Let retargetedElement be the result of retargeting element against this.
If no such element exists, then continue.
-Append candidate to - elements.
Append retargetedElement to retargetedElements.
Return elements.
The getter steps are:
- -Let elements be the result of running this's get the - attr-associated elements.
If the contents of elements is equal to the contents of this's - cached attr-associated elements, then return this's - cached attr-associated elements object.
If the contents of retargetedElements is equal to the contents of + this's cached attr-associated elements, then return + this's cached attr-associated elements object.
Let elementsAsFrozenArray be elements, Let elementsAsFrozenArray be retargetedElements, converted to a FrozenArray<T>?
.
Set this's cached attr-associated elements to - elements.
Set this's cached attr-associated elements object to elementsAsFrozenArray.
For those, specification authors must use the reflected target's - get the attr-associated element and get the - attr-associated elements, respectively. The content attribute presence and value - must not be used as they cannot be fully synchronized with the reflected IDL - attribute.
+ get the attr-associated element + and get the attr-associated elements, respectively. The content attribute + presence and value must not be used as they cannot be fully synchronized with the reflected + IDL attribute.A reflected target's explicitly set attr-element,
explicitly set attr-elements, cached attr-associated
@@ -44174,21 +44305,22 @@ interface HTMLTableCellElement : HTMLElement {
The A td
and th
element may have a headers
content attribute specified. The headers
attribute, if specified, must contain a string
- consisting of an unordered set of unique space-separated tokens, none of which are
- identical to another token and each of which must have the value of an ID of a th
element taking part in the same table as the td
or th
element (as defined by the table model).th
element with ID id is
- said to be directly targeted by all td
and th
elements in the
- same table that have headers
attributes whose values include as one of their tokens
- the ID id. A th
element A is said to be targeted by a th
or td
element
- B if either A is directly targeted by B or if there exists an element C that is itself
- targeted by the element B and A is directly
- targeted by C.headers
-associated elements is a th
+ element taking part in the same table as the td
+ or th
element (as defined by the table model).
A th
element X is said to be directly targeted by a
+ td
or th
element Y in the same table if X is referred to by Y's
+ headers
attribute.
+ A th
element A is said to be targeted by a th
or
+ td
element B if either A is directly targeted by
+ B or if there exists an element C that is itself targeted by the
+ element B and A is directly targeted by C.
A th
element must not be targeted by itself.
Take the value of the principal cell's headers
attribute and split it on ASCII whitespace, letting id list be the
- list of tokens obtained.
For each token in the id list, if the
- first element in the Document
with an ID equal to
- the token is a cell in the same table, and that cell is not the
- principal cell, then add that cell to header list.
For each element in the principal cell's
+
+ headers
-associated elements, if
+ element is a cell in the same table, and that
+ cell is not the principal cell, then add element to
+ header list.
The label
element represents a caption in a user interface. The
caption can be associated with a specific form control, known as the
- label
element's labeled control, either using the label
element's labeled control, either using the for
attribute, or by putting the form control inside the
label
element itself.
Except where otherwise specified by the following rules, a label
element has no
- 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.
To determine a label
element's labeled control, run these steps:
If the label
's for
attribute is
+ specified, then:
If the for-associated element is not null, and the for-associated element is a labelable element, return that element.
Otherwise, return null.
For each descendant descendant of the
+ label
in tree order:
Let candidate be the result of + resolving the reference target on + descendant.
If candidate is a labelable element, + return candidate.
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.
Return null.
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
@@ -46540,8 +46681,15 @@ interface HTMLLabelElement : HTMLElement {
attribute.
The control
- IDL attribute must return the label
element's labeled control, if any,
- or null if there isn't one.
If the label
element has no labeled control, then return
+ null.
Return the result of retargeting the label
+ element's labeled control against the label
element.
The form
IDL
attribute must run the following steps:
If the label
element's labeled control is not a
form-associated element, then return null.
Return the label
element's labeled control's form
- owner (which can still be null).
If the label
element's labeled control's form
+ owner is null, return null.
Return the result of retargeting the
+ label
element's labeled control's form owner against the
+ label
element.
The list
attribute is
used to identify an element that lists predefined options suggested to the user.
If present, its value must be the ID of a datalist
- element in the same tree.
If present, its value must a valid single element reference attribute referring to a datalist
.
The suggestions source element is the first element in
- the tree in tree order to have an ID
- equal to the value of the list
attribute, if that element
- is a datalist
element. If there is no list
- attribute, or if there is no element with that ID, or if the
- first element with that ID is not a datalist
- element, then there is no suggestions source
- element.
The suggestions source element is the list
-associated
+ element, if that element is a datalist
element. If the
+
+ list
-associated element is null or is not a
+ datalist
element, then there is no suggestions
+ source element.
If there is a suggestions source element, then, when
the user agent is allowing the user to edit the The input
element's
list
IDL
attribute must return the current suggestions source
- element, if any, or null otherwise.
The for
content
attribute allows an explicit relationship to be made between the result of a calculation and the
elements that represent the values that went into the calculation or that otherwise influenced the
- calculation. The for
attribute, if specified, must contain a
- string consisting of an unordered set of unique space-separated tokens, none of which
- are identical to another token and each of which must have the value of an ID of an element in the same tree.
for
attribute, if specified, must be a
+ valid unordered set of unique element references.
The If a listed form-associated element has a
form
attribute is used to explicitly associate the
output
element with its form owner. The HTMLLegendElement : HTMLElement {
form
attribute specified, then that attribute's value must be
- the ID of a form
element in the element's
- tree.form
+ element.
When a listed form-associated element has a
- form
attribute and the ID of
- any of the elements in the tree changes, then the user agent must reset the
- form owner of that form-associated element.
When a listed form-associated element has a
- form
attribute and an element with an ID is inserted
- into or removed from the
- Document
, or its HTML element moving steps are run, then the user agent
- must reset the form owner of that form-associated element.
form
attribute and that element's
+ form
-associated
+ element changes, then the user agent must reset the form owner of the
+ form-associated element.
The form owner is also reset by the HTML element insertion steps, HTML element removing steps, and HTML element moving steps.
@@ -56724,13 +56869,14 @@ interface HTMLLegendElement : HTMLElement { data-x="attr-fae-form">form content attribute, and is connected, then:If the first element in element's tree, in tree
- order, to have an ID that is identical to
- element's form
content attribute's value, is a
- form
element, then associate the
- element with that form
element.
Let candidate be the
+ form
-associated element.
If candidate is a form
element, then associate the element with that
+ form
element.
shadowrootdelegatesfocus
shadowrootclonable
shadowrootserializable
shadowrootreferencetarget
HTMLTemplateElement
.The shadowrootreferencetarget
content
+ attribute can be set to create a declarative shadow root with the given
+ reference target.
The template contents of a template
element are not children of the element itself.
shadowrootserializable
content attribute.
+ The shadowRootReferenceTarget
IDL
+ attribute must reflect the
+ shadowrootreferencetarget
content attribute.
The cloning steps for template
@@ -76664,10 +76822,8 @@ Demos:
specified, to give a list of additional elements to crawl to find the name-value pairs of the
item.
The itemref
attribute, if specified, must have a value that
- is an unordered set of unique space-separated tokens none of which are
- identical to another token and consisting of IDs of
- elements in the same tree.
The itemref
attribute, if specified, must be a valid
+ unordered set of unique element references attribute.
The itemref
attribute must not be specified on elements that
do not have an itemscope
attribute specified.
Add the child elements of root, if any, to pending.
If root has an itemref
attribute, split the value of that itemref
attribute on ASCII whitespace. For each resulting
- token ID, if there is an element in the tree of root with the
- ID ID, then add the first such element to
- pending.
If root has an itemref
attribute, set
+ pending to the
+ itemref
-associated elements.
While pending is not empty:
@@ -87623,9 +87776,8 @@ dictionary DragEventInit : MouseEventInit {If specified, the popovertarget
attribute value must
- be the ID of an element with a popover
attribute in the same tree as the button with the single element reference attribute
+ referring to an element with the
popovertarget
attribute.
The popovertargetaction
attribute is an
@@ -131485,6 +131637,10 @@ document.body.appendChild(text);
data-x="attr-template-shadowrootdelegatesfocus">shadowrootdelegatesfocus attribute;
otherwise false.
Let referenceTarget be the value of the template start tag's
+ shadowrootreferencetarget
+ attribute if it has one; otherwise null.
If declarative shadow host element is a shadow host, then insert an element at the adjusted insertion location with template.
Attach a shadow root with
declarative shadow host element, mode, clonable,
- serializable, delegatesFocus, and "named
".
named
",
+ and referenceTarget.
If an exception is thrown, then catch it and:
@@ -135324,6 +135481,9 @@ document.body.appendChild(text);If shadow's clonable is set, then append
" shadowrootclonable=""
".
If shadow's reference target is set, then append
+ " shadowrootreferencetarget=""
".
Append ">
".
Append the value of running the HTML fragment serialization algorithm with @@ -143976,7 +144136,7 @@ interface External {
for
output
form
button
;
@@ -144026,7 +144186,7 @@ interface External {
td
;
th
height
canvas
;
@@ -144144,7 +144304,7 @@ interface External {
itemref
itemscope
open
";
"closed
"
+ shadowrootreferencetarget
+ template
+ shadowrootserializable
template