liveBook · Manning

Dropdown

As explained in Secrets of the JavaScript Ninja, Second Edition

An HTML element that provides a control for selecting among options.

A dropdown uses a select element to contain options. When converting an HTML string into DOM nodes, keep option markup inside a select; the parser uses a select wrapper for option fragments. section 12.1 section 12.1.1

<option>Yoshi</option>
<option>Kuma</option>
<table/>

This fragment shows option markup without its required select container. section 12.1.1

How Secrets of the JavaScript Ninja, Second Edition covers it

How deep it goes
Explains option containment and shows wrapper-based parsing, but does not detail dropdown selection behavior.
Examples
Uses ninja options and self-closing table markup to illustrate HTML preprocessing and wrapping.
What you can do after
Apply the containment rule by wrapping option markup in select when converting HTML strings into DOM nodes.
How it connects
Connects select and option elements with HTML parsing, innerHTML, and DOM nodes.

Also explained in

Compare how 10 books explain dropdown →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Secrets of the JavaScript Ninja, Second Edition. The section links point to the parts of the book it draws on.