diff options
author | Patrick Shaughnessy <pshaughn@comcast.net> | 2020-01-21 11:06:31 -0500 |
---|---|---|
committer | Patrick Shaughnessy <pshaughn@comcast.net> | 2020-02-13 11:21:46 -0500 |
commit | f29e22f131291ed1bcd581cb9be6807c66c1534e (patch) | |
tree | cdc19a2442457a09caef9b661c97a3bb2d823364 /components/script/dom/document.rs | |
parent | 43c558fa597901f30f6994e2d99858f2954fdce2 (diff) | |
download | servo-f29e22f131291ed1bcd581cb9be6807c66c1534e.tar.gz servo-f29e22f131291ed1bcd581cb9be6807c66c1534e.zip |
Names should now be consistently atoms
Diffstat (limited to 'components/script/dom/document.rs')
-rw-r--r-- | components/script/dom/document.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 98e7663bbf1..84a63d16238 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -823,6 +823,7 @@ impl Document { } fn get_anchor_by_name(&self, name: &str) -> Option<DomRoot<Element>> { + // TODO faster name lookups (see #25548) let check_anchor = |node: &HTMLAnchorElement| { let elem = node.upcast::<Element>(); elem.get_attribute(&ns!(), &local_name!("name")) @@ -4091,9 +4092,7 @@ impl DocumentMethods for Document { if element.namespace() != &ns!(html) { return false; } - element - .get_attribute(&ns!(), &local_name!("name")) - .map_or(false, |attr| &**attr.value() == &*name) + element.get_name().map_or(false, |atom| *atom == *name) }) } @@ -4303,6 +4302,7 @@ impl DocumentMethods for Document { } // https://html.spec.whatwg.org/multipage/#dom-document-nameditem-filter fn filter_by_name(name: &Atom, node: &Node) -> bool { + // TODO faster name lookups (see #25548) let html_elem_type = match node.type_id() { NodeTypeId::Element(ElementTypeId::HTMLElement(type_)) => type_, _ => return false, |