1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:17:44 +00:00

LibWeb: Add FlyString versions of NamedNodeMap::get_attribute_ns

This is the API for NamedNodeMap which we are wanting to eventually use
instead of taking a StringView. Currently we just end up deferring to
the StringView versions of these functions, but at some stage in the
future, this will allow us to have O(1) comparison when making attribute
lookups.

In the meantime, the advantage of this API is that it makes it much less
awkward to use than the StringView variant when you have an
Optional<FlyString> namespace to pass through.
This commit is contained in:
Shannon Booth 2023-11-05 11:11:01 +13:00 committed by Andreas Kling
parent 49dbc4b5a5
commit 1812221a2d
2 changed files with 20 additions and 0 deletions

View file

@ -52,6 +52,9 @@ public:
void replace_attribute(Attr& old_attribute, Attr& new_attribute, size_t old_attribute_index);
void append_attribute(Attr& attribute);
Attr* get_attribute_ns(Optional<FlyString> const& namespace_, FlyString const& local_name, size_t* item_index = nullptr);
Attr const* get_attribute_ns(Optional<FlyString> const& namespace_, FlyString const& local_name, size_t* item_index = nullptr) const;
// FIXME: This should take a 'FlyString cosnt&'
Attr const* remove_attribute(StringView qualified_name);
Attr const* remove_attribute_ns(StringView namespace_, StringView local_name);