diff options
author | Corey Farwell <coreyf@rwell.org> | 2015-11-11 22:12:56 -0500 |
---|---|---|
committer | Corey Farwell <coreyf@rwell.org> | 2015-11-11 22:12:56 -0500 |
commit | 00fa3b2f85fde78f7af8e4636ee7b55a9aecc28d (patch) | |
tree | 8f263e1519958de6bc0f2fd39bd3fe5cabdd7c7b /components/script | |
parent | 49d48a8680003267f29ebf8cd47c244b07f4c4d2 (diff) | |
download | servo-00fa3b2f85fde78f7af8e4636ee7b55a9aecc28d.tar.gz servo-00fa3b2f85fde78f7af8e4636ee7b55a9aecc28d.zip |
Implement Default trait for DOMString
Diffstat (limited to 'components/script')
-rw-r--r-- | components/script/dom/documenttype.rs | 4 | ||||
-rw-r--r-- | components/script/dom/node.rs | 6 |
2 files changed, 5 insertions, 5 deletions
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::<Node>() == 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<DOMString>) { if let Some(character_data) = self.downcast::<CharacterData>() { - 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<DOMString>) { - let value = value.unwrap_or(DOMString::new()); + let value = value.unwrap_or_default(); match self.type_id() { NodeTypeId::DocumentFragment | NodeTypeId::Element(..) => { |