Skip to content

Commit

Permalink
implement the setter for Node.nodeValue.(fixes #1825)
Browse files Browse the repository at this point in the history
  • Loading branch information
lpy committed Mar 7, 2014
1 parent 07b8c9b commit 0130392
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/components/script/dom/node.rs
Expand Up @@ -924,9 +924,16 @@ impl Node {
}

// http://dom.spec.whatwg.org/#dom-node-nodevalue
pub fn SetNodeValue(&mut self, _abstract_self: &JS<Node>, _val: Option<DOMString>)
pub fn SetNodeValue(&mut self, abstract_self: &mut JS<Node>, val: Option<DOMString>)
-> ErrorResult {
// FIXME (#1825) implement.
match self.type_id {
CommentNodeTypeId |
TextNodeTypeId |
ProcessingInstructionNodeTypeId => {
self.SetTextContent(abstract_self, val);
}
_ => {}
}
Ok(())
}

Expand Down
19 changes: 19 additions & 0 deletions src/test/html/content/test_document_set_node_value.html
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<script src="harness.js"></script>
<body>
<div id="div" class="div-class">A</div>
<p>P</p>
<script>
is(document.nodeValue, null);
var div = document.getElementById("div");
is(div.nodeValue, null);
is(div.firstChild.nodeValue, "A");
div.firstChild.nodeValue = "B";
is(div.firstChild.nodeValue, "B");
var commentNode = document.createComment("comment node");
is(commentNode.nodeValue, "comment node");
finish();
</script>
</body>
</html>

5 comments on commit 0130392

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging lpy/servo/issue1825 = 0130392 into auto

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lpy/servo/issue1825 = 0130392 merged ok, testing candidate = cdec81e

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = cdec81e

Please sign in to comment.