From 00fa3b2f85fde78f7af8e4636ee7b55a9aecc28d Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Wed, 11 Nov 2015 22:12:56 -0500 Subject: Implement Default trait for DOMString --- components/script/dom/documenttype.rs | 4 ++-- components/script/dom/node.rs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'components/script') diff --git a/components/script/dom/documenttype.rs b/components/script/dom/documenttype.rs index ed5a64307cc..d8dbf01ed88 100644 --- a/components/script/dom/documenttype.rs +++ b/components/script/dom/documenttype.rs @@ -31,8 +31,8 @@ impl DocumentType { DocumentType { node: Node::new_inherited(document), name: name, - public_id: public_id.unwrap_or(DOMString::new()), - system_id: system_id.unwrap_or(DOMString::new()) + public_id: public_id.unwrap_or_default(), + system_id: system_id.unwrap_or_default(), } } #[allow(unrooted_must_root)] diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index ca5b14b192c..fbddb713736 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -825,7 +825,7 @@ impl Node { .map(|elem| elem.upcast::() == self) .unwrap_or(false), - shortValue: self.GetNodeValue().unwrap_or(DOMString::new()), //FIXME: truncate + shortValue: self.GetNodeValue().unwrap_or_default(), //FIXME: truncate incompleteValue: false, //FIXME: reflect truncation } } @@ -1893,7 +1893,7 @@ impl NodeMethods for Node { // https://dom.spec.whatwg.org/#dom-node-nodevalue fn SetNodeValue(&self, val: Option) { if let Some(character_data) = self.downcast::() { - character_data.SetData(val.unwrap_or(DOMString::new())); + character_data.SetData(val.unwrap_or_default()); } } @@ -1918,7 +1918,7 @@ impl NodeMethods for Node { // https://dom.spec.whatwg.org/#dom-node-textcontent fn SetTextContent(&self, value: Option) { - let value = value.unwrap_or(DOMString::new()); + let value = value.unwrap_or_default(); match self.type_id() { NodeTypeId::DocumentFragment | NodeTypeId::Element(..) => { -- cgit v1.2.3