Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

Commit 42b3931

Browse files
vicbjbdeboer
authored andcommitted
fix(web components): Fix tests in IE10
Closes #1372
1 parent 56e382f commit 42b3931

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed
+14-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
/**
2-
* Used to create Javascript Web Components from Dart tests
2+
* Registers Javascript Web Components from Dart tests.
3+
*
4+
* Per HTML5 spec, the prototype object should inherit from `HTMLELement`.
5+
* see http://w3c.github.io/webcomponents/spec/custom/#extensions-to-document-interface-to-register
6+
*
7+
* Note: __proto__ can not be used as it is not supported in IE10.
38
*/
49
function angularTestsRegisterElement(name, prototype) {
5-
// Polymer requires that all prototypes are chained to HTMLElement
6-
// https://github.com/Polymer/CustomElements/issues/121
7-
prototype.__proto__ = HTMLElement.prototype;
8-
prototype.createdCallback = function() {};
9-
document.registerElement(name, {prototype: prototype});
10+
var proto = Object.create(HTMLElement.prototype);
11+
for (var p in prototype) {
12+
if (prototype.hasOwnProperty(p)) {
13+
proto[p] = prototype[p];
14+
}
15+
}
16+
proto.createdCallback = function() {};
17+
document.registerElement(name, {prototype: proto});
1018
}

0 commit comments

Comments
 (0)