mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-25 19:56:30 +00:00
LibWeb: Remove Document::validate_qualified_name()
This is no longer used and appears to have been removed from the specification.
This commit is contained in:
parent
16dbb44de2
commit
70f9eb9d8f
Notes:
github-actions[bot]
2025-06-19 13:08:05 +00:00
Author: https://github.com/tcl3
Commit: 70f9eb9d8f
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5142
Reviewed-by: https://github.com/gmta ✅
2 changed files with 0 additions and 55 deletions
|
@ -3604,55 +3604,6 @@ bool Document::is_valid_name(String const& name)
|
|||
return true;
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#validate
|
||||
WebIDL::ExceptionOr<Document::PrefixAndTagName> Document::validate_qualified_name(JS::Realm& realm, FlyString const& qualified_name)
|
||||
{
|
||||
if (qualified_name.is_empty())
|
||||
return WebIDL::InvalidCharacterError::create(realm, "Empty string is not a valid qualified name."_string);
|
||||
|
||||
auto utf8view = qualified_name.code_points();
|
||||
|
||||
Optional<size_t> colon_offset;
|
||||
|
||||
bool at_start_of_name = true;
|
||||
|
||||
for (auto it = utf8view.begin(); it != utf8view.end(); ++it) {
|
||||
auto code_point = *it;
|
||||
if (code_point == ':') {
|
||||
if (colon_offset.has_value())
|
||||
return WebIDL::InvalidCharacterError::create(realm, "More than one colon (:) in qualified name."_string);
|
||||
colon_offset = utf8view.byte_offset_of(it);
|
||||
at_start_of_name = true;
|
||||
continue;
|
||||
}
|
||||
if (at_start_of_name) {
|
||||
if (!is_valid_name_start_character(code_point))
|
||||
return WebIDL::InvalidCharacterError::create(realm, "Invalid start of qualified name."_string);
|
||||
at_start_of_name = false;
|
||||
continue;
|
||||
}
|
||||
if (!is_valid_name_character(code_point))
|
||||
return WebIDL::InvalidCharacterError::create(realm, "Invalid character in qualified name."_string);
|
||||
}
|
||||
|
||||
if (!colon_offset.has_value())
|
||||
return Document::PrefixAndTagName {
|
||||
.prefix = {},
|
||||
.tag_name = qualified_name,
|
||||
};
|
||||
|
||||
if (*colon_offset == 0)
|
||||
return WebIDL::InvalidCharacterError::create(realm, "Qualified name can't start with colon (:)."_string);
|
||||
|
||||
if (*colon_offset >= (qualified_name.bytes_as_string_view().length() - 1))
|
||||
return WebIDL::InvalidCharacterError::create(realm, "Qualified name can't end with colon (:)."_string);
|
||||
|
||||
return Document::PrefixAndTagName {
|
||||
.prefix = MUST(FlyString::from_utf8(qualified_name.bytes_as_string_view().substring_view(0, *colon_offset))),
|
||||
.tag_name = MUST(FlyString::from_utf8(qualified_name.bytes_as_string_view().substring_view(*colon_offset + 1))),
|
||||
};
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-document-createnodeiterator
|
||||
GC::Ref<NodeIterator> Document::create_node_iterator(Node& root, unsigned what_to_show, GC::Ptr<NodeFilter> filter)
|
||||
{
|
||||
|
|
|
@ -567,12 +567,6 @@ public:
|
|||
|
||||
static bool is_valid_name(String const&);
|
||||
|
||||
struct PrefixAndTagName {
|
||||
FlyString prefix;
|
||||
FlyString tag_name;
|
||||
};
|
||||
static WebIDL::ExceptionOr<PrefixAndTagName> validate_qualified_name(JS::Realm&, FlyString const& qualified_name);
|
||||
|
||||
GC::Ref<NodeIterator> create_node_iterator(Node& root, unsigned what_to_show, GC::Ptr<NodeFilter>);
|
||||
GC::Ref<TreeWalker> create_tree_walker(Node& root, unsigned what_to_show, GC::Ptr<NodeFilter>);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue