feat(dom): add replaceChild to DOM adapter
This commit is contained in:
parent
a55efbd8b8
commit
123ee8e06f
|
@ -67,6 +67,9 @@ class BrowserDomAdapter extends GenericBrowserDomAdapter {
|
|||
void removeChild(Element el, Node node) {
|
||||
node.remove();
|
||||
}
|
||||
void replaceChild(Node el, Node newNode, Node oldNode) {
|
||||
oldNode.replaceWith(newNode);
|
||||
}
|
||||
Element remove(Element el) {
|
||||
return el..remove();
|
||||
}
|
||||
|
|
|
@ -90,6 +90,9 @@ export class BrowserDomAdapter extends GenericBrowserDomAdapter {
|
|||
removeChild(el, node) {
|
||||
el.removeChild(node);
|
||||
}
|
||||
replaceChild(el: Node, newChild, oldChild) {
|
||||
el.replaceChild(newChild, oldChild);
|
||||
}
|
||||
remove(el) {
|
||||
var parent = el.parentNode;
|
||||
parent.removeChild(el);
|
||||
|
|
|
@ -90,6 +90,9 @@ export class DomAdapter {
|
|||
removeChild(el, node) {
|
||||
throw _abstract();
|
||||
}
|
||||
replaceChild(el, newNode, oldNode) {
|
||||
throw _abstract();
|
||||
}
|
||||
remove(el) {
|
||||
throw _abstract();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue