mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-07 00:29:15 +00:00
LibWeb: Update validate_and_extract
and its users to the latest spec
This commit is contained in:
parent
c6cc7e1874
commit
4593c28769
Notes:
github-actions[bot]
2025-06-19 10:02:24 +00:00
Author: https://github.com/tcl3
Commit: 4593c28769
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5140
Reviewed-by: https://github.com/AtkinsSJ ✅
11 changed files with 1744 additions and 25 deletions
|
@ -2138,8 +2138,8 @@ WebIDL::ExceptionOr<GC::Ref<Element>> Document::create_element(String const& loc
|
|||
// https://dom.spec.whatwg.org/#internal-createelementns-steps
|
||||
WebIDL::ExceptionOr<GC::Ref<Element>> Document::create_element_ns(Optional<FlyString> const& namespace_, String const& qualified_name, Variant<String, ElementCreationOptions> const& options)
|
||||
{
|
||||
// 1. Let namespace, prefix, and localName be the result of passing namespace and qualifiedName to validate and extract.
|
||||
auto extracted_qualified_name = TRY(validate_and_extract(realm(), namespace_, qualified_name));
|
||||
// 1. Let (namespace, prefix, localName) be the result of validating and extracting namespace and qualifiedName given "element".
|
||||
auto extracted_qualified_name = TRY(validate_and_extract(realm(), namespace_, qualified_name, ValidationContext::Element));
|
||||
|
||||
// 2. Let is be null.
|
||||
Optional<String> is_value;
|
||||
|
@ -4507,11 +4507,10 @@ WebIDL::ExceptionOr<GC::Ref<Attr>> Document::create_attribute(String const& loca
|
|||
// https://dom.spec.whatwg.org/#dom-document-createattributens
|
||||
WebIDL::ExceptionOr<GC::Ref<Attr>> Document::create_attribute_ns(Optional<FlyString> const& namespace_, String const& qualified_name)
|
||||
{
|
||||
// 1. Let namespace, prefix, and localName be the result of passing namespace and qualifiedName to validate and extract.
|
||||
auto extracted_qualified_name = TRY(validate_and_extract(realm(), namespace_, qualified_name));
|
||||
// 1. Let (namespace, prefix, localName) be the result of validating and extracting namespace and qualifiedName given "attribute".
|
||||
auto extracted_qualified_name = TRY(validate_and_extract(realm(), namespace_, qualified_name, ValidationContext::Attribute));
|
||||
|
||||
// 2. Return a new attribute whose namespace is namespace, namespace prefix is prefix, local name is localName, and node document is this.
|
||||
|
||||
return Attr::create(*this, extracted_qualified_name);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue