5.18.19
xiaoiver
released this
01 Nov 03:10
·
66 commits
to next
since this release
Patch Changes
- Updated dependencies [51b42d0]
- @antv/[email protected]
- @antv/[email protected]
- @antv/[email protected]
- @antv/[email protected]
The insertBefore()
method inserts a node before a reference node as a child of a specified parent node.
const group1 = new Element();
const group2 = new Element();
const group3 = new Element();
const group4 = new Element();
// 2, 4, 3
group1.append(group2, group3);
group1.insertBefore(group4, group3);
If the given node already exists in the document, insertBefore() moves it from its current position to the new position. That is, it will automatically be removed from its existing parent before appending it to the specified new parent.
// 2, 3, 4 -> 2, 4, 3
group1.append(group2, group3, group4);
group1.insertBefore(group4, group3);
If refNode
is null, then newNode
is inserted at the end of node's child nodes.
// 2, 3, 4
group1.append(group2, group3);
group1.insertBefore(group4, null);
If refNode
is not the child of parentNode
, then newNode
is inserted at the end of node's child nodes.
// 2, 3, 4
group1.append(group2, group3);
group1.insertBefore(group4, group5); // non-existed node