1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:47:45 +00:00

LibWeb/HTML: Implement text attribute in HTMLTitleElement

This commit is contained in:
Kemal Zebari 2023-12-01 18:59:08 -08:00 committed by Andreas Kling
parent d6df13af6a
commit 24b9d05ea8
5 changed files with 48 additions and 19 deletions

View file

@ -34,4 +34,18 @@ void HTMLTitleElement::children_changed()
}
}
// https://html.spec.whatwg.org/multipage/semantics.html#dom-title-text
DeprecatedString HTMLTitleElement::text()
{
// The text attribute's getter must return this title element's child text content.
return child_text_content();
}
// https://html.spec.whatwg.org/multipage/semantics.html#dom-title-text
void HTMLTitleElement::set_text(String const& value)
{
// The text attribute's setter must string replace all with the given value within this title element.
string_replace_all(value.to_deprecated_string());
}
}

View file

@ -17,6 +17,9 @@ class HTMLTitleElement final : public HTMLElement {
public:
virtual ~HTMLTitleElement() override;
DeprecatedString text();
void set_text(String const& value);
private:
HTMLTitleElement(DOM::Document&, DOM::QualifiedName);

View file

@ -6,6 +6,6 @@ interface HTMLTitleElement : HTMLElement {
[HTMLConstructor] constructor();
// FIXME: [CEReactions] attribute DOMString text;
[CEReactions] attribute DOMString text;
};