From f9d72bd85bfe91130e4e0b29729f69ac0c96027c Mon Sep 17 00:00:00 2001 From: Jacob MacDonald Date: Thu, 18 Jun 2015 15:33:09 -0700 Subject: [PATCH] fix(transformer): Throw unimplemented errors in HtmlAdapter. closes #2624 closes #2627 --- modules/angular2/src/dom/html_adapter.dart | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/modules/angular2/src/dom/html_adapter.dart b/modules/angular2/src/dom/html_adapter.dart index 86a5573236..b41ddc4156 100644 --- a/modules/angular2/src/dom/html_adapter.dart +++ b/modules/angular2/src/dom/html_adapter.dart @@ -126,12 +126,15 @@ class Html5LibDomAdapter implements DomAdapter { clearNodes(el) { throw 'not implemented'; } - appendChild(el, node) => null; + appendChild(el, node) => el.append(node.remove()); removeChild(el, node) { throw 'not implemented'; } - remove(el) => null; - insertBefore(el, node) => null; + remove(el) => el.remove(); + insertBefore(el, node) { + if (el.parent == null) throw '$el must have a parent'; + el.parent.insertBefore(node, el); + } insertAllBefore(el, nodes) { throw 'not implemented'; } @@ -229,9 +232,11 @@ class Html5LibDomAdapter implements DomAdapter { getAttribute(element, String attribute) { throw 'not implemented'; } - setAttribute(element, String name, String value) => null; + setAttribute(element, String name, String value) { + element.attributes[name] = value; + } removeAttribute(element, String attribute) { - throw 'not implemented'; + element.attributes.remove(attribute); } templateAwareRoot(el) => el;