LibWeb: Check for valid names in Document.createElement() & friends

We now validate that the provided tag names are valid XML tag names,
and otherwise throw an "invalid character" DOM exception.

2% progression on ACID3. :^)
This commit is contained in:
Andreas Kling 2022-02-26 10:00:49 +01:00
parent 8daf603f46
commit fe67fe3791
Notes: sideshowbarker 2024-07-17 18:15:12 +09:00
7 changed files with 82 additions and 24 deletions

View file

@ -171,7 +171,7 @@ void HTMLInputElement::create_shadow_tree_if_needed()
auto initial_value = attribute(HTML::AttributeNames::value);
if (initial_value.is_null())
initial_value = String::empty();
auto element = document().create_element(HTML::TagNames::div);
auto element = document().create_element(HTML::TagNames::div).release_value();
element->set_attribute(HTML::AttributeNames::style, "white-space: pre; padding-top: 1px; padding-bottom: 1px; padding-left: 2px; padding-right: 2px");
m_text_node = adopt_ref(*new DOM::Text(document(), initial_value));
m_text_node->set_always_editable(true);