mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 18:17:22 +02:00
LibWeb: Support :placeholder-shown pseudo-class for textarea elements
Previously only input elements were matched. Add placeholder_value() to HTMLTextAreaElement mirroring the HTMLInputElement API and update both selector matching code paths to handle textarea.
This commit is contained in:
committed by
Jelle Raaijmakers
parent
933eee8284
commit
ebd312689e
Notes:
github-actions[bot]
2026-02-11 15:12:26 +00:00
Author: https://github.com/Praise-Garfield Commit: https://github.com/LadybirdBrowser/ladybird/commit/ebd312689e9 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/7888 Reviewed-by: https://github.com/gmta ✅
@@ -477,6 +477,16 @@ bool HTMLTextAreaElement::is_mutable() const
|
||||
return enabled() && !has_attribute(AttributeNames::readonly);
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/form-elements.html#attr-textarea-placeholder
|
||||
Optional<String> HTMLTextAreaElement::placeholder_value() const
|
||||
{
|
||||
if (!m_text_node || !m_text_node->data().is_empty())
|
||||
return {};
|
||||
if (!has_attribute(HTML::AttributeNames::placeholder))
|
||||
return {};
|
||||
return get_attribute_value(HTML::AttributeNames::placeholder);
|
||||
}
|
||||
|
||||
GC::Ptr<Layout::Node> HTMLTextAreaElement::create_layout_node(GC::Ref<CSS::ComputedProperties> style)
|
||||
{
|
||||
return heap().allocate<Layout::TextAreaBox>(document(), *this, style);
|
||||
|
||||
Reference in New Issue
Block a user