From 013039242044243c4a8e92fe44c8920640721184 Mon Sep 17 00:00:00 2001 From: lpy Date: Thu, 6 Mar 2014 13:23:31 +0800 Subject: [PATCH] implement the setter for Node.nodeValue.(fixes #1825) --- src/components/script/dom/node.rs | 11 +++++++++-- .../content/test_document_set_node_value.html | 19 +++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 src/test/html/content/test_document_set_node_value.html diff --git a/src/components/script/dom/node.rs b/src/components/script/dom/node.rs index 4efa6ddbf9a..200c8845812 100644 --- a/src/components/script/dom/node.rs +++ b/src/components/script/dom/node.rs @@ -924,9 +924,16 @@ impl Node { } // http://dom.spec.whatwg.org/#dom-node-nodevalue - pub fn SetNodeValue(&mut self, _abstract_self: &JS, _val: Option) + pub fn SetNodeValue(&mut self, abstract_self: &mut JS, val: Option) -> ErrorResult { - // FIXME (#1825) implement. + match self.type_id { + CommentNodeTypeId | + TextNodeTypeId | + ProcessingInstructionNodeTypeId => { + self.SetTextContent(abstract_self, val); + } + _ => {} + } Ok(()) } diff --git a/src/test/html/content/test_document_set_node_value.html b/src/test/html/content/test_document_set_node_value.html new file mode 100644 index 00000000000..20762a93674 --- /dev/null +++ b/src/test/html/content/test_document_set_node_value.html @@ -0,0 +1,19 @@ + + + + +
A
+

P

+ + +