Index: tools/dom/src/dartium_CustomElementSupport.dart |
diff --git a/tools/dom/src/dartium_CustomElementSupport.dart b/tools/dom/src/dartium_CustomElementSupport.dart |
index f221be5a4fceb990b3185194a1bdb468f2f649a6..edcaec85c42e512d4f664eb9a0dce6bcbe975c9e 100644 |
--- a/tools/dom/src/dartium_CustomElementSupport.dart |
+++ b/tools/dom/src/dartium_CustomElementSupport.dart |
@@ -27,15 +27,23 @@ class _VMElementUpgrader implements ElementUpgrader { |
} |
Element upgrade(element) { |
- if (element.runtimeType != js.JsObjectImpl) { |
- throw new UnsupportedError('Element is incorrect type'); |
+ var jsObject; |
+ var tag; |
+ if (element.runtimeType == HtmlElement) { |
+ jsObject = unwrap_jso(element); |
+ tag = element.localName; |
+ } else if (element.runtimeType == js.JsObjectImpl) { |
+ // It's a Polymer core element (written in JS). |
+ jsObject = element; |
+ tag = element['localName']; |
+ } else { |
+ throw new UnsupportedError('Element is incorrect type. Got ${element.runtimeType}, expected HtmlElement/JsObjectImpl.'); |
} |
// Remember Dart class to tagName for any upgrading done in wrap_jso. |
- var tag = element['localName']; |
_knownCustomeElements[tag] = _type; |
- return createCustomUpgrader(_nativeType, element); |
+ return createCustomUpgrader(_nativeType, jsObject); |
} |
} |