WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
301858
Update <option> when descendants change
https://bugs.webkit.org/show_bug.cgi?id=301858
Summary
Update <option> when descendants change
Anne van Kesteren
Reported
2025-11-03 04:37:57 PST
We currently update the <option> element when its immediate children change, but to be fully correct we need to update it when descendants change. See this demo which requires HTMLEnhancedSelectParsingEnabled and should show "24" after clicking: <p><select id=select> <div> <option>2<div id=evil>3</div></option> </div> <div> <option>1</option> </div> </select> <p><button onclick=evil.textContent='4'>Click</button> This is not a critical issue, but would be nice to do correctly. Here's a sketch from rniwa on how to approach this:
> I think we want to add a new Node flag to identify any descendent of option. Something like StateFlag::HasOptionAsAncestor. Then we want to propagate this flag in insertedIntoAncestor and removedFromAncestor. See Element::updateEffectiveTextDirectionIfNeeded() for an example. Once this flag is properly updated, we want to add a [[unlikely]] if statement which notifies option in Element::childrenChanged.
Attachments
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2025-11-10 04:38:11 PST
<
rdar://problem/164396354
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug