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

Commit 3e50d85

Browse files
committed
Merge pull request #53 from Polymer/master
8/8 master -> stable
2 parents a800e8e + f908f0c commit 3e50d85

3 files changed

Lines changed: 15 additions & 7 deletions

File tree

MutationObservers

src/CustomElements.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,24 @@
1616

1717
(function(scope) {
1818

19+
// imports
20+
1921
if (!scope) {
2022
scope = window.CustomElements = {flags:{}};
2123
}
24+
var flags = scope.flags;
2225

2326
// native document.register?
2427

25-
scope.hasNative = scope.flags.register && (document.webkitRegister || document.register);
26-
if (scope.hasNative) {
28+
var hasNative = Boolean(document.webkitRegister || document.register);
29+
var useNative = !flags.register && hasNative;
30+
31+
if (useNative) {
2732

2833
// normalize
2934
document.register = document.register || document.webkitRegister;
3035

36+
// stub
3137
var nop = function() {};
3238

3339
// exports
@@ -88,7 +94,7 @@ if (scope.hasNative) {
8894
// TODO(sjmiles): probably should clone inOptions instead of mutating it
8995
var definition = inOptions || {};
9096
if (!inName) {
91-
// TODO(sjmiles): replace with more appropriate error (Erik can probably
97+
// TODO(sjmiles): replace with more appropriate error (EricB can probably
9298
// offer guidance)
9399
throw new Error('Name argument must not be empty');
94100
}
@@ -97,7 +103,7 @@ if (scope.hasNative) {
97103
// must have a prototype, default to an extension of HTMLElement
98104
// TODO(sjmiles): probably should throw if no prototype, check spec
99105
if (!definition.prototype) {
100-
// TODO(sjmiles): replace with more appropriate error (Erik can probably
106+
// TODO(sjmiles): replace with more appropriate error (EricB can probably
101107
// offer guidance)
102108
throw new Error('Options missing required prototype property');
103109
}
@@ -348,7 +354,9 @@ if (scope.hasNative) {
348354
* @return {Element} The upgraded element.
349355
*/
350356
scope.upgrade = upgradeElement;
351-
352357
}
353358

359+
scope.hasNative = hasNative;
360+
scope.useNative = useNative;
361+
354362
})(window.CustomElements);

tools

Submodule tools updated 34 files

0 commit comments

Comments
 (0)