diff --git a/source b/source index 07296f7c4ae..454e418abf9 100644 --- a/source +++ b/source @@ -3190,7 +3190,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
HTMLCollection
interface, its
length
attribute, and its
@@ -5206,6 +5206,248 @@ 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 referenceTargetValue 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 + referenceTargetValue.
+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, optionally given a boolean retarget + (default false), 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.
+If candidate is null, return null.
Let resolvedCandidate be the result of resolving the reference target on + candidate.
If retarget is true, and resolvedCandidate is not null, return + candidate.
Return resolvedCandidate
.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, optionally + given a boolean retarget (default false), are:
+ +If the attribute is not specified on element, return null.
Let candidates be an empty list.
If element has an explicitly set attr-elements which + +
For each attrElement in + element'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:
+If retarget is true, append candidate to + resolvedCandidates.
Otherwise, 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 with retarget set to true.
Return null.
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 @@ -8635,99 +8835,23 @@ 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:
- -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.
Append attrElement to - elements.
Otherwise:
- -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.
If no such element exists, then continue.
-Append candidate to - elements.
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 elements 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, converted to a FrozenArray<T>?
.
Set this's cached attr-associated elements to elements.
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
@@ -34567,7 +34691,7 @@ interface HTMLObjectElement : HTMLElement {
[CEReactions, ReflectURL] attribute USVString data;
[CEReactions, Reflect] attribute DOMString type;
[CEReactions, Reflect] attribute DOMString name;
- readonly attribute HTMLFormElement? form;
+ readonly attribute HTMLElement? form;
[CEReactions, Reflect] attribute DOMString width;
[CEReactions, Reflect] attribute DOMString height;
readonly attribute Document? contentDocument;
@@ -44164,21 +44288,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 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 candidate is a labelable element, + return candidate.
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
@@ -46497,8 +46632,15 @@ interface HTMLLabelElement : HTMLElement {
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 form
attribute is used to explicitly associate the
output
element with its form owner. The HTMLFieldSetElement : HTMLElement {
[HTMLConstructor] constructor();
[CEReactions, Reflect] attribute boolean disabled;
- readonly attribute HTMLFormElement? form;
+ readonly attribute HTMLElement? form;
[CEReactions, Reflect] attribute DOMString name;
readonly attribute DOMString type;
@@ -56748,7 +56892,7 @@ interface HTMLFieldSetElement : HTMLElement {
interface HTMLLegendElement : HTMLElement {
[HTMLConstructor] constructor();
- readonly attribute HTMLFormElement? form;
+ readonly attribute HTMLElement? form;
// also has obsolete members
};
@@ -57070,8 +57214,9 @@ interface HTMLSelectedContentElement : HTMLElementIf a listed form-associated element has a
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.
@@ -57137,13 +57276,14 @@ interface HTMLSelectedContentElement : HTMLElementform 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.
form
IDL attribute, which, on getting, must return the
- element's form owner, or null if there isn't one.
+ data-x="dom-fae-form">form IDL attribute, which, on getting, must return the result
+ of retargeting the element's form owner against
+ the element, or null if there isn't a form owner.
Form-associated custom elements don't have
form
IDL attribute. Instead, their
@@ -57209,8 +57350,9 @@ interface HTMLSelectedContentElement : HTMLElementform IDL attribute. On getting, it must throw a
"NotSupportedError
" DOMException
if the target element is not a form-associated custom
- element. Otherwise, it must return the element's form owner, or null if there
- isn't one.
shadowrootclonable
shadowrootserializable
shadowrootcustomelementregistry
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.
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:
@@ -88086,10 +88230,9 @@ 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 popovertarget
attribute.
popover
attribute.
The popovertargetaction
attribute is an
enumerated attribute with the following keywords and states:
Let referenceTarget be the value of templateStartTag's
+ shadowrootreferencetarget
+ attribute if it has one; otherwise null.
If declarativeShadowHostElement is a shadow host, then insert an element at the adjusted insertion location with template.
Attach a shadow root with
declarativeShadowHostElement, mode, clonable,
- serializable, delegatesFocus, "named
", and
- registry.
named
",
+ referenceTarget, and registry.
If an exception is thrown, then catch it and:
@@ -136210,6 +136357,18 @@ document.body.appendChild(text); data-x="shadow-root-custom-element-registry">custom element registry, then append " shadowrootcustomelementregistry=""
".If shadow's reference target is set, then:
+ +Append " shadowrootreferencetarget="
".
Append shadow's reference target.
Append ""
".
Append ">
".
Append the value of running the HTML fragment serialization algorithm with @@ -144678,7 +144837,7 @@ interface External {
for
output
form
button
;
@@ -144728,7 +144887,7 @@ interface External {
td
;
th
height
canvas
;
@@ -144846,7 +145005,7 @@ interface External {
itemref
itemscope
open
";
"closed
"
+ shadowrootreferencetarget
+ template
+ shadowrootserializable
template