mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 13:49:16 +00:00
LibWeb: Update attribute name validation in Document.createAttribute()
This now follows the latest specification steps.
This commit is contained in:
parent
ba641d4784
commit
727b4f5e89
Notes:
github-actions[bot]
2025-06-19 10:02:07 +00:00
Author: https://github.com/tcl3
Commit: 727b4f5e89
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5140
Reviewed-by: https://github.com/AtkinsSJ ✅
1 changed files with 4 additions and 4 deletions
|
@ -2106,8 +2106,8 @@ HTML::EnvironmentSettingsObject& Document::relevant_settings_object() const
|
|||
// https://dom.spec.whatwg.org/#dom-document-createelement
|
||||
WebIDL::ExceptionOr<GC::Ref<Element>> Document::create_element(String const& local_name, Variant<String, ElementCreationOptions> 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<GC::Ref<Attr>> 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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue