Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 09798e6f16d630da3ed15f4ba0b7a3a9ac1615fb
https://github.com/WebKit/WebKit/commit/09798e6f16d630da3ed15f4ba0b7a3a9ac1615fb
Author: Alexsander Borges Damaceno <[email protected]>
Date: 2026-04-16 (Thu, 16 Apr 2026)
Changed paths:
M LayoutTests/TestExpectations
M LayoutTests/fast/forms/HTMLOptionElement_label02-expected.html
M LayoutTests/fast/forms/HTMLOptionElement_label02.html
M LayoutTests/fast/forms/HTMLOptionElement_label04-expected.html
M LayoutTests/fast/forms/HTMLOptionElement_label04.html
M Source/WebCore/html/HTMLOptionElement.cpp
Log Message:
-----------
`Option` element renders incorrectly when the label value is empty.
https://bugs.webkit.org/show_bug.cgi?id=312119
Reviewed by Anne van Kesteren.
When an <option> element has an empty label attribute, it renders the empty
string,
resulting in a blank item in the selection list. This behavior differs from
Firefox and Chromium.
According to the HTML specification "4.10.10 The option element":
"The label attribute provides a label for the element.
The label of an option element is the value of the label content attribute,
if there is one and its value is not the empty string, or,
otherwise, the value of the element's text IDL attribute."
Option spec:
https://html.spec.whatwg.org/multipage/form-elements.html#the-option-element
This means that when the label attribute is empty, the element’s text content
should be used instead.
During rendering, the `HTMLOptionElement::label()` function is called to
retrieve the label text.
If a label attribute is present, it returns that value, otherwise, it falls
back to the option’s text content.
This patch adds a check to ensure that the label attribute is not empty before
returning its value,
allowing proper fallback to the text content when necessary.
Canonical link: https://commits.webkit.org/311421@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications