From 2779e0a7ed71296c3c9f6cba2038a4a506e7ade0 Mon Sep 17 00:00:00 2001 From: Philipp Hartwig Date: Sun, 31 May 2015 20:26:47 +0200 Subject: [PATCH] Restrict output of getElementsByName to HTML elements https://html.spec.whatwg.org/#dom-document-getelementsbyname --- components/script/dom/document.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index ad7af5562f9..18b50faff5d 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -1540,6 +1540,9 @@ impl<'a> DocumentMethods for JSRef<'a, Document> { Some(element) => element, None => return false, }; + if element.namespace() != &ns!(HTML) { + return false; + } element.get_attribute(&ns!(""), &atom!("name")).root().map_or(false, |attr| { // FIXME(https://github.com/rust-lang/rust/issues/23338) let attr = attr.r();