Skip to content

Commit

Permalink
feat(dom): add replaceChild to DOM adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffbcross committed Mar 31, 2015
1 parent a55efbd commit 123ee8e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions modules/angular2/src/dom/browser_adapter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
3 changes: 3 additions & 0 deletions modules/angular2/src/dom/browser_adapter.es6
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions modules/angular2/src/dom/dom_adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ export class DomAdapter {
removeChild(el, node) {
throw _abstract();
}
replaceChild(el, newNode, oldNode) {
throw _abstract();
}
remove(el) {
throw _abstract();
}
Expand Down

0 comments on commit 123ee8e

Please sign in to comment.