Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1ad23df7317368e222ffaa18375c6039fb8e8481
      
https://github.com/WebKit/WebKit/commit/1ad23df7317368e222ffaa18375c6039fb8e8481
  Author: Chris Dumez <[email protected]>
  Date:   2026-04-17 (Fri, 17 Apr 2026)

  Changed paths:
    M 
LayoutTests/imported/w3c/web-platform-tests/html/dom/elements/the-innertext-and-outertext-properties/getter-expected.txt
    M Source/WebCore/editing/TextIterator.cpp

  Log Message:
  -----------
  innerText getter: preserve contents of <option> elements inside <select>
https://bugs.webkit.org/show_bug.cgi?id=312558

Reviewed by Anne van Kesteren.

The TextIterator treats <select> as a replaced element (via 
HTMLFormControlElement),
which causes handleReplacedElement() to skip all children. This means innerText 
on
a <select> (or a parent containing one) returns "" instead of the option text.

Add special handling in handleReplacedElement() for <select> elements in 
innerText
mode: walk the select's <option> and <optgroup> children and emit their text 
content
separated by newlines.

No new tests, rebaselined existing test. Chrome was already passing those 2
subtests. Firefox is passing only the second one.

* 
LayoutTests/imported/w3c/web-platform-tests/html/dom/elements/the-innertext-and-outertext-properties/getter-expected.txt:
Rebaselined.

* Source/WebCore/editing/TextIterator.cpp:
(WebCore::collectSelectInnerText):
Walks a select element's option/optgroup children and collects option text
separated by newlines.

(WebCore::TextIterator::handleReplacedElement):
In innerText mode, emit collected option text for select elements instead
of skipping them.

Canonical link: https://commits.webkit.org/311449@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to