mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-04 07:09:47 +00:00
LibWeb: Create Element::attributes (NamedNodeMap) lazily
Many elements have zero attributes, and they don't need a NamedNodeMap until someone asks for it.
This commit is contained in:
parent
5085b0dd66
commit
94cc4adefd
Notes:
github-actions[bot]
2025-04-20 16:44:29 +00:00
Author: https://github.com/awesomekling
Commit: 94cc4adefd
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4408
3 changed files with 53 additions and 16 deletions
|
@ -2035,7 +2035,7 @@ Optional<String> Node::locate_a_namespace(Optional<String> const& prefix) const
|
|||
// 4. If it has an attribute whose namespace is the XMLNS namespace, namespace prefix is "xmlns", and local name is prefix,
|
||||
// or if prefix is null and it has an attribute whose namespace is the XMLNS namespace, namespace prefix is null,
|
||||
// and local name is "xmlns", then return its value if it is not the empty string, and null otherwise.
|
||||
if (auto* attributes = element.attributes()) {
|
||||
if (auto attributes = element.attributes()) {
|
||||
for (size_t i = 0; i < attributes->length(); ++i) {
|
||||
auto& attr = *attributes->item(i);
|
||||
if (attr.namespace_uri() == Web::Namespace::XMLNS) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue