From 727b4f5e89b80adc4294bf70e784b5a384c4d436 Mon Sep 17 00:00:00 2001 From: Tim Ledbetter Date: Thu, 19 Jun 2025 08:58:59 +0100 Subject: [PATCH] LibWeb: Update attribute name validation in `Document.createAttribute()` This now follows the latest specification steps. --- Libraries/LibWeb/DOM/Document.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Libraries/LibWeb/DOM/Document.cpp b/Libraries/LibWeb/DOM/Document.cpp index 289d540b5b3..0401470bf57 100644 --- a/Libraries/LibWeb/DOM/Document.cpp +++ b/Libraries/LibWeb/DOM/Document.cpp @@ -2106,8 +2106,8 @@ HTML::EnvironmentSettingsObject& Document::relevant_settings_object() const // https://dom.spec.whatwg.org/#dom-document-createelement WebIDL::ExceptionOr> Document::create_element(String const& local_name, Variant const& options) { - // 1. If localName does not match the Name production, then throw an "InvalidCharacterError" DOMException. - if (!is_valid_name(local_name)) + // 1. If localName is not a valid element local name, then throw an "InvalidCharacterError" DOMException. + if (!is_valid_element_local_name(local_name)) return WebIDL::InvalidCharacterError::create(realm(), "Invalid character in tag name."_string); // 2. If this is an HTML document, then set localName to localName in ASCII lowercase. @@ -4495,8 +4495,8 @@ String Document::dump_accessibility_tree_as_json() // https://dom.spec.whatwg.org/#dom-document-createattribute WebIDL::ExceptionOr> Document::create_attribute(String const& local_name) { - // 1. If localName does not match the Name production in XML, then throw an "InvalidCharacterError" DOMException. - if (!is_valid_name(local_name)) + // 1. If localName is not a valid attribute local name, then throw an "InvalidCharacterError" DOMException. + if (!is_valid_attribute_local_name(local_name)) return WebIDL::InvalidCharacterError::create(realm(), "Invalid character in attribute name."_string); // 2. If this is an HTML document, then set localName to localName in ASCII lowercase.