1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 06:38:10 +00:00

LibWeb: Implement bare-bones HTMLElement.dir

This commit is contained in:
Igor Pissolati 2022-11-04 22:56:42 -03:00 committed by Andrew Kaster
parent de494ccf38
commit bfdb30c74a
4 changed files with 29 additions and 0 deletions

View file

@ -53,6 +53,24 @@ void HTMLElement::visit_edges(Cell::Visitor& visitor)
visitor.visit(m_dataset.ptr());
}
// https://html.spec.whatwg.org/multipage/dom.html#dom-dir
String HTMLElement::dir() const
{
auto dir = attribute(HTML::AttributeNames::dir);
#define __ENUMERATE_HTML_ELEMENT_DIR_ATTRIBUTE(keyword) \
if (dir.equals_ignoring_case(#keyword##sv)) \
return #keyword##sv;
ENUMERATE_HTML_ELEMENT_DIR_ATTRIBUTES
#undef __ENUMERATE_HTML_ELEMENT_DIR_ATTRIBUTE
return {};
}
void HTMLElement::set_dir(String const& dir)
{
MUST(set_attribute(HTML::AttributeNames::dir, dir));
}
HTMLElement::ContentEditableState HTMLElement::content_editable_state() const
{
auto contenteditable = attribute(HTML::AttributeNames::contenteditable);