Use 'DOMString' to define the type insteand of '~str'.

At now, 'DOMString' is equal to '~str'.
155befe10d/src/components/script/dom/bindings/utils.rs (L119)
This commit is contained in:
Tetsuharu OHZEKI 2013-11-23 12:14:00 +09:00
parent aa72c413ed
commit 4e4eb10ffc

View file

@ -92,7 +92,7 @@ pub struct Document {
window: @mut Window,
doctype: DocumentType,
title: ~str,
idmap: HashMap<~str, AbstractNode<ScriptView>>
idmap: HashMap<DOMString, AbstractNode<ScriptView>>
}
impl Document {
@ -326,7 +326,7 @@ impl Document {
}
pub fn register_nodes_with_id(&mut self, root: &AbstractNode<ScriptView>) {
foreach_ided_elements(root, |id: &~str, abstract_node: &AbstractNode<ScriptView>| {
foreach_ided_elements(root, |id: &DOMString, abstract_node: &AbstractNode<ScriptView>| {
// TODO: "in tree order, within the context object's tree"
// http://dom.spec.whatwg.org/#dom-document-getelementbyid.
self.idmap.find_or_insert(id.clone(), *abstract_node);
@ -334,7 +334,7 @@ impl Document {
}
pub fn unregister_nodes_with_id(&mut self, root: &AbstractNode<ScriptView>) {
foreach_ided_elements(root, |id: &~str, _| {
foreach_ided_elements(root, |id: &DOMString, _| {
// TODO: "in tree order, within the context object's tree"
// http://dom.spec.whatwg.org/#dom-document-getelementbyid.
self.idmap.pop(id);
@ -366,7 +366,7 @@ impl Document {
#[inline(always)]
fn foreach_ided_elements(root: &AbstractNode<ScriptView>,
callback: &fn(&~str, &AbstractNode<ScriptView>)) {
callback: &fn(&DOMString, &AbstractNode<ScriptView>)) {
for node in root.traverse_preorder() {
if !node.is_element() {
continue;