Implement <selectedoption> for StylableSelect

Merged
CH
3y ago
+82-0

This patch adds support for the <selectedoption> element to <select>.
The <selectedoption> element replaces its innerHTML with the ancestor
<select>'s selected <option>s innerHTML whenever the selected <option>
changes.

This patch implements it using a SynchronousMutationObserver with an
IsDescendantOf check, which might be slow. I added some comments in the
header with ideas of how to improve the performance.

Bug: 1511354
Change-Id: I38be4657e11dd766cef1fc974e16da173fdf829d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5370555
Reviewed-by: David Baron <dbaron@chromium.org>
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1280361}