Define the `<selectedcontent>` element

Closed
JO
1y ago
+336-16

The <selectedcontent> element is part of the customizable <select> proposal: https://github.com/whatwg/html/issues/9799

It allows authors to declaratively clone the contents of the currently selected <option> of a <select> and style it independently for use in a base appearance <select>'s button.

Some details on the cloning behavior, which were decided on in order to always make sure that the selectedcontent element is up to date and in order to reduce developer confusion:

  • Cloning is done with an algorithm similar to the Node.cloneNode() function.
  • Cloning is done synchronously at these times:
    • When an </option> end tag is parsed during HTML parsing.
    • A selectedcontent element is inserted, during its post-connection steps.
    • Immediately before input and change events are fired on a select element.
    • When the select.selectedIndex IDL is assigned to.

Fixes https://github.com/whatwg/html/issues/10520

The selectedcontent element has been discussed generally here: https://github.com/w3c/csswg-drafts/issues/10242

html-aria PR: https://github.com/w3c/html-aria/pull/528
html-aam PR: https://github.com/w3c/aria/pull/2344

(See WHATWG Working Mode: Changes for more details.)


/form-control-infrastructure.html ( diff )
/form-elements.html ( diff )
/index.html ( diff )
/indices.html ( diff )
/infrastructure.html ( diff )
/interactive-elements.html ( diff )
/parsing.html ( diff )