mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
auto merge of #1621 : abustany/servo/fix-insert-before, r=Ms2ger
Closes issue #1572
This commit is contained in:
commit
8165703e72
3 changed files with 28 additions and 2 deletions
|
@ -316,6 +316,7 @@ DOMInterfaces = {
|
||||||
'pointerType': '',
|
'pointerType': '',
|
||||||
'needsAbstract': [
|
'needsAbstract': [
|
||||||
'appendChild',
|
'appendChild',
|
||||||
|
'insertBefore',
|
||||||
'replaceChild',
|
'replaceChild',
|
||||||
'nodeName',
|
'nodeName',
|
||||||
'nodeValue',
|
'nodeValue',
|
||||||
|
|
|
@ -1346,9 +1346,9 @@ impl Node {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn InsertBefore(&self, node: AbstractNode, child: Option<AbstractNode>)
|
pub fn InsertBefore(&self, abstract_self: AbstractNode, node: AbstractNode, child: Option<AbstractNode>)
|
||||||
-> Fallible<AbstractNode> {
|
-> Fallible<AbstractNode> {
|
||||||
Node::pre_insert(node, node, child)
|
Node::pre_insert(node, abstract_self, child)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn wait_until_safe_to_modify_dom(&self) {
|
pub fn wait_until_safe_to_modify_dom(&self) {
|
||||||
|
|
25
src/test/html/content/test_node_insertBefore.html
Normal file
25
src/test/html/content/test_node_insertBefore.html
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
<!doctype html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Node.insertBefore</title>
|
||||||
|
<script src="harness.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script type="text/javascript">
|
||||||
|
// test1: insertBefore
|
||||||
|
{
|
||||||
|
var root = document.createElement("div");
|
||||||
|
var after = document.createElement("div");
|
||||||
|
var before = document.createElement("div");
|
||||||
|
|
||||||
|
root.appendChild(after);
|
||||||
|
|
||||||
|
is(root.insertBefore(before, after), before, "test1-0, insertBefore");
|
||||||
|
is(root.childNodes[0], before, "test1-1, insertBefore");
|
||||||
|
is(root.childNodes[1], after, "test1-2, insertBefore");
|
||||||
|
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Add table
Add a link
Reference in a new issue