mirror of
https://github.com/servo/servo.git
synced 2025-06-20 15:18:58 +01:00
commit
cdec81ea4f
2 changed files with 28 additions and 2 deletions
|
@ -924,9 +924,16 @@ impl Node {
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-node-nodevalue
|
// 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 {
|
-> ErrorResult {
|
||||||
// FIXME (#1825) implement.
|
match self.type_id {
|
||||||
|
CommentNodeTypeId |
|
||||||
|
TextNodeTypeId |
|
||||||
|
ProcessingInstructionNodeTypeId => {
|
||||||
|
self.SetTextContent(abstract_self, val);
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
19
src/test/html/content/test_document_set_node_value.html
Normal file
19
src/test/html/content/test_document_set_node_value.html
Normal file
|
@ -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>
|
Loading…
Add table
Add a link
Reference in a new issue