mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Cleanup Document::GetElementsByName.
This commit is contained in:
parent
d22964792a
commit
9416e9b11a
1 changed files with 4 additions and 5 deletions
|
@ -863,11 +863,10 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
||||||
// http://www.whatwg.org/specs/web-apps/current-work/#dom-document-getelementsbyname
|
// http://www.whatwg.org/specs/web-apps/current-work/#dom-document-getelementsbyname
|
||||||
fn GetElementsByName(self, name: DOMString) -> Temporary<NodeList> {
|
fn GetElementsByName(self, name: DOMString) -> Temporary<NodeList> {
|
||||||
self.createNodeList(|node| {
|
self.createNodeList(|node| {
|
||||||
if !node.is_element() {
|
let element: JSRef<Element> = match ElementCast::to_ref(node) {
|
||||||
return false;
|
Some(element) => element,
|
||||||
}
|
None => return false,
|
||||||
|
};
|
||||||
let element: JSRef<Element> = ElementCast::to_ref(node).unwrap();
|
|
||||||
element.get_attribute(ns!(""), &atom!("name")).root().map_or(false, |attr| {
|
element.get_attribute(ns!(""), &atom!("name")).root().map_or(false, |attr| {
|
||||||
attr.value().as_slice() == name.as_slice()
|
attr.value().as_slice() == name.as_slice()
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue