aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom
diff options
context:
space:
mode:
authorMs2ger <ms2ger@gmail.com>2014-11-04 17:23:18 +0100
committerMs2ger <ms2ger@gmail.com>2014-11-05 16:05:06 +0100
commitcdde96e989dc453296acedb598b2cdb6a18b8da5 (patch)
treebe9887b2c10392e25c4ff0a21df2df689f0b7070 /components/script/dom
parent026b5e34eaabc572858f1c7de668eacb4ab84c3f (diff)
downloadservo-cdde96e989dc453296acedb598b2cdb6a18b8da5.tar.gz
servo-cdde96e989dc453296acedb598b2cdb6a18b8da5.zip
Defer to GetAttribute in HasAttribute.
The semantics of has_attribute aren't anywhere close to the ones expected for Element#hasAttribute, and it fails an assertion when passed non-lower-case names.
Diffstat (limited to 'components/script/dom')
-rw-r--r--components/script/dom/element.rs11
1 files changed, 1 insertions, 10 deletions
diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs
index a81c515aef8..b317974569e 100644
--- a/components/script/dom/element.rs
+++ b/components/script/dom/element.rs
@@ -854,16 +854,7 @@ impl<'a> ElementMethods for JSRef<'a, Element> {
// http://dom.spec.whatwg.org/#dom-element-hasattribute
fn HasAttribute(self, name: DOMString) -> bool {
- // Step 1.
- if self.html_element_in_html_document() {
- // TODO(pcwalton): Small string optimization here.
- return self.has_attribute(&Atom::from_slice(name.as_slice()
- .to_ascii_lower()
- .as_slice()))
- }
-
- // Step 2.
- self.has_attribute(&Atom::from_slice(name.as_slice()))
+ self.GetAttribute(name).is_some()
}
// http://dom.spec.whatwg.org/#dom-element-hasattributens