From 21b8a2c916a39d76ce433b93addd47461a8e1b73 Mon Sep 17 00:00:00 2001
From: Joey Arhar
Run maybe clone option into selectedoption given + insertedNode.
The removing steps for the HTML Standard, given @@ -1838,6 +1841,9 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
If removedNode's popover
attribute is not in
the no popover state, then run the hide
popover algorithm given removedNode, false, false, and false.
Run maybe clone option into selectedoption given + oldParent.
A id
attribute
setAttribute()
methodtextContent
attributereplaceChildren()
methodoption
element children of all the optgroup
element
children of the select
element, in tree order.
Every select
element has select descendant selectedoption elements,
+ which is a list of selectedoption
elements, initially « ».
The required
attribute is a boolean attribute. When specified, the user will be required to select
a value before submitting the form.
To get the option element ancestor select given an option
+ option:
For each ancestor of option's ancestors:
+ +If ancestor is a select
, then return
+ ancestor.
Return null.
To maybe clone option into selectedoption, given an Element
+ element:
For each ancestor of element's ancestors:
+ +If all of the following conditions are true:
+ +ancestor is an option
element;
ancestor has a non-null option element ancestor + select;
ancestor's option element ancestor select is rendered as a + drop-down box;
ancestor's selectedness + is true,
then for each selectedoption of ancestor's option element + ancestor select's select descendant selectedoption elements, run + clone an option into a selectedoption given ancestor and + selectedoption.
+Whenever an option
option's selectedness is set to true, run maybe clone
+ option into selectedoption given option.
option.selected
selectedoption
elementThe selectedoption
element reflects the contents of a select
+ element's currently selected option
element. selectedoption
elements can
+ be used to declaratively show the selected option
element's contents in a different
+ part of the document, such as the select
element's invoker button, with alternate
+ rendering based on different selectors in the author's stylesheet.
Every time the selected option
of a select
switches from one option
+ to another, or the currently selected option
's descendant DOM structure mutates, the
+ selectedoption
element removes all of its children and replaces them with a new
+ cloned copy of the DOM structure of the select
's selected option
+ element.
selectedoption
elements become associated with select
elements when
+ the selectedoption
is a descendant of the select
.
To clone an option into a selectedoption, given an option
element
+ option and a selectedoption
element selectedOption:
Let nodes be « ».
If option is not null, then for each child of option's children:
+ +Let childClone be the result of running clone given child, null, true.
Append childClone to + nodes.
Run replaceChildren on + selectedOption given nodes.
The selectedoption
HTML element insertion steps, given
+ selectedoption, are:
Let firstAncestorSelect be null.
Let ancestor be selectedoption's parent.
While firstAncestorSelect is null and ancestor is not + null:
+ +If ancestor is a select
element, then set
+ firstAncestorSelect to ancestor.
Set ancestor to ancestor's parent.
If firstAncestorSelect is null, then return.
Append selectedoption to + firstAncestorSelect's select descendant selectedoption elements.
Run clone an option into a selectedoption given the first option
+ in firstAncestorSelect's list of
+ options whose selectedness is true and
+ insertedNode.
The selectedoption
HTML element removing steps, given
+ selectedoption and oldParent, are:
For each ancestor of selectedoption's ancestors:
+ +If ancestor is a select
element, then return.
For each ancestor of oldParent's inclusive ancestors:
+ +If ancestor is a select
element, then:
remove selectedoption from + ancestor's select descendant selectedoption elements.
Run clone an option into a selectedoption given null and + selectedoption.
Return.
The following attribute change
+ steps, given element, localName, oldValue,
+ value, and namespace are used for all HTML elements in order to
+ support selectedoption
elements:
Run maybe clone option into selectedoption given element.