replaceBy method
Replaces this node with elements
.
remap
Iftrue
will remap the new element at treeMap (only ifelements
represents 1 element).
Implementation
bool replaceBy(List? elements, {bool remap = false}) {
if (elements == null) return false;
var e = domGenerator.toElements(elements);
var ok = domGenerator.replaceElement(node, e);
var treeMap = this.treeMap;
if (ok && treeMap != null && domNode != null) {
treeMap.removeByDOMNode(domNode);
if (remap && e != null && e.length == 1) {
var node2 = e.first;
var domNode2 = domGenerator.revert(treeMap, node2);
if (domNode2 != null) {
treeMap.mapTree(domNode2, node2);
}
}
}
return ok;
}