aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/dom/document.rs
diff options
context:
space:
mode:
authorbors-servo <release+servo@mozilla.com>2014-02-16 06:02:05 -0500
committerbors-servo <release+servo@mozilla.com>2014-02-16 06:02:05 -0500
commit41f55059a80156408368e375c2118066798958b9 (patch)
tree959f1849a8498ac11133c65dd3c1ddee2ed2e02c /src/components/script/dom/document.rs
parenta0b55b4c6cfacf3c9d59a07c8ee756c0dffad7f9 (diff)
parentf5561975671807492d81a11d0bab2567350309f0 (diff)
downloadservo-41f55059a80156408368e375c2118066798958b9.tar.gz
servo-41f55059a80156408368e375c2118066798958b9.zip
auto merge of #1703 : Ms2ger/servo/strings-cleanup, r=jdm
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 {