Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: aec657a17a98a4da59daa52d0a3ea4053edd8816
https://github.com/WebKit/WebKit/commit/aec657a17a98a4da59daa52d0a3ea4053edd8816
Author: Chris Dumez <[email protected]>
Date: 2026-04-15 (Wed, 15 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/dom/Element.cpp
Log Message:
-----------
innerText getter: don't fall back to textContent for display:contents elements
https://bugs.webkit.org/show_bug.cgi?id=312370
Reviewed by Darin Adler.
Element::innerText() falls back to textContent() when the element has no
renderer. However, display:contents elements intentionally don't generate
a renderer while their children still participate in layout. The textContent
fallback returns raw text without whitespace processing, so calling
innerText on a display:contents element like <div style='display:contents'>
would incorrectly preserve whitespace that should be collapsed.
Fix this by using plainText() (via TextIterator) for display:contents
elements, which correctly processes their children according to CSS
whitespace rules. This matches the Blink implementation.
No new tests, rebaseline existing WPT test. This subtest was already
passing in both Firefox and Chrome.
*
LayoutTests/imported/w3c/web-platform-tests/html/dom/elements/the-innertext-and-outertext-properties/getter-expected.txt:
* Source/WebCore/dom/Element.cpp:
(WebCore::Element::innerText):
Canonical link: https://commits.webkit.org/311339@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications