feat(dom): add replaceChild to DOM adapter

This commit is contained in:
Jeff Cross 2015-03-26 16:26:44 -07:00
parent a55efbd8b8
commit 123ee8e06f
3 changed files with 9 additions and 0 deletions

View File

@ -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();
}

View File

@ -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);

View File

@ -90,6 +90,9 @@ export class DomAdapter {
removeChild(el, node) {
throw _abstract();
}
replaceChild(el, newNode, oldNode) {
throw _abstract();
}
remove(el) {
throw _abstract();
}