aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/dom/document.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/script/dom/document.rs')
-rw-r--r--src/components/script/dom/document.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/components/script/dom/document.rs b/src/components/script/dom/document.rs
index 4807eaa02ad..37df96353a9 100644
--- a/src/components/script/dom/document.rs
+++ b/src/components/script/dom/document.rs
@@ -32,7 +32,6 @@ use js::jsapi::{JSObject, JSContext, JSTracer};
use std::ascii::StrAsciiExt;
use std::cast;
use std::hashmap::HashMap;
-use std::str::eq_slice;
use std::unstable::raw::Box;
#[deriving(Eq)]
@@ -247,7 +246,7 @@ impl Document {
// http://dom.spec.whatwg.org/#dom-document-getelementsbytagname
pub fn GetElementsByTagName(&self, tag: DOMString) -> @mut HTMLCollection {
- self.createHTMLCollection(|elem| eq_slice(elem.tag_name, tag))
+ self.createHTMLCollection(|elem| elem.tag_name == tag)
}
// http://dom.spec.whatwg.org/#dom-document-getelementsbytagnamens
@@ -342,7 +341,7 @@ impl Document {
for child in node.children() {
if child.is_text() {
child.with_imm_text(|text| {
- title = title + text.characterdata.Data();
+ title.push_str(text.characterdata.data.as_slice());
});
}
}
@@ -467,8 +466,11 @@ impl Document {
// http://www.whatwg.org/specs/web-apps/current-work/#dom-document-getelementsbyname
pub fn GetElementsByName(&self, name: DOMString) -> @mut HTMLCollection {
- self.createHTMLCollection(|elem|
- elem.get_attribute(Null, "name").is_some() && eq_slice(elem.get_attribute(Null, "name").unwrap().value_ref(), name))
+ self.createHTMLCollection(|elem| {
+ elem.get_attribute(Null, "name").map_default(false, |attr| {
+ attr.value_ref() == name
+ })
+ })
}
pub fn createHTMLCollection(&self, callback: |elem: &Element| -> bool) -> @mut HTMLCollection {