diff --git a/test/core_dom/web_components_support.js b/test/core_dom/web_components_support.js index 4f09d1190..fee3a6a29 100644 --- a/test/core_dom/web_components_support.js +++ b/test/core_dom/web_components_support.js @@ -1,10 +1,18 @@ /** - * Used to create Javascript Web Components from Dart tests + * Registers Javascript Web Components from Dart tests. + * + * Per HTML5 spec, the prototype object should inherit from `HTMLELement`. + * see http://w3c.github.io/webcomponents/spec/custom/#extensions-to-document-interface-to-register + * + * Note: __proto__ can not be used as it is not supported in IE10. */ function angularTestsRegisterElement(name, prototype) { - // Polymer requires that all prototypes are chained to HTMLElement - // https://github.com/Polymer/CustomElements/issues/121 - prototype.__proto__ = HTMLElement.prototype; - prototype.createdCallback = function() {}; - document.registerElement(name, {prototype: prototype}); + var proto = Object.create(HTMLElement.prototype); + for (var p in prototype) { + if (prototype.hasOwnProperty(p)) { + proto[p] = prototype[p]; + } + } + proto.createdCallback = function() {}; + document.registerElement(name, {prototype: proto}); }