Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Unified Diff: third_party/polymer/v1_0/components-chromium/polymer/polymer-micro-extracted.js

Issue 1336623003: [MD settings] updating polymer to 1.1.13 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: changed Polymer.IronCheckedElementBehavior name Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/polymer/v1_0/components-chromium/polymer/polymer-micro-extracted.js
diff --git a/third_party/polymer/v1_0/components-chromium/polymer/polymer-micro-extracted.js b/third_party/polymer/v1_0/components-chromium/polymer/polymer-micro-extracted.js
index 1927c935f35462f58e7255c370315063f2e222ba..38293de2cb21a9a66dc6853bf3a177bc178cddc9 100644
--- a/third_party/polymer/v1_0/components-chromium/polymer/polymer-micro-extracted.js
+++ b/third_party/polymer/v1_0/components-chromium/polymer/polymer-micro-extracted.js
@@ -12,7 +12,7 @@ addEventListener('DOMContentLoaded', resolve);
}
}
}());
-Polymer = {
+window.Polymer = {
Settings: function () {
var user = window.Polymer || {};
location.search.slice(1).split('&').forEach(function (o) {
@@ -40,15 +40,21 @@ useNativeCustomElements: useNativeCustomElements
(function () {
var userPolymer = window.Polymer;
window.Polymer = function (prototype) {
-var ctor = desugar(prototype);
-prototype = ctor.prototype;
+if (typeof prototype === 'function') {
+prototype = prototype.prototype;
+}
+if (!prototype) {
+prototype = {};
+}
+var factory = desugar(prototype);
+prototype = factory.prototype;
var options = { prototype: prototype };
if (prototype.extends) {
options.extends = prototype.extends;
}
Polymer.telemetry._registrate(prototype);
document.registerElement(prototype.is, options);
-return ctor;
+return factory;
};
var desugar = function (prototype) {
var base = Polymer.Base;
@@ -125,6 +131,8 @@ _addFeature: function (feature) {
this.extend(this, feature);
},
registerCallback: function () {
+this._desugarBehaviors();
+this._doBehavior('beforeRegister');
this._registerFeatures();
this._doBehavior('registered');
},
@@ -209,6 +217,9 @@ Polymer.telemetry.instanceCount = 0;
(function () {
var modules = {};
var lcModules = {};
+var findModule = function (id) {
+return modules[id] || lcModules[id.toLowerCase()];
+};
var DomModule = function () {
return document.createElement('dom-module');
};
@@ -227,31 +238,27 @@ lcModules[id.toLowerCase()] = this;
}
},
import: function (id, selector) {
-var m = modules[id] || lcModules[id.toLowerCase()];
+if (id) {
+var m = findModule(id);
if (!m) {
forceDocumentUpgrade();
-m = modules[id];
+m = findModule(id);
}
if (m && selector) {
m = m.querySelector(selector);
}
return m;
}
+}
});
var cePolyfill = window.CustomElements && !CustomElements.useNative;
-if (cePolyfill) {
-var ready = CustomElements.ready;
-CustomElements.ready = true;
-}
document.registerElement('dom-module', DomModule);
-if (cePolyfill) {
-CustomElements.ready = ready;
-}
function forceDocumentUpgrade() {
if (cePolyfill) {
var script = document._currentScript || document.currentScript;
-if (script) {
-CustomElements.upgradeAll(script.ownerDocument);
+var doc = script && script.ownerDocument;
+if (doc) {
+CustomElements.upgradeAll(doc);
}
}
}
@@ -272,11 +279,17 @@ this.is = this.is.toLowerCase();
});
Polymer.Base._addFeature({
behaviors: [],
-_prepBehaviors: function () {
+_desugarBehaviors: function () {
if (this.behaviors.length) {
-this.behaviors = this._flattenBehaviorsList(this.behaviors);
+this.behaviors = this._desugarSomeBehaviors(this.behaviors);
}
-this._prepAllBehaviors(this.behaviors);
+},
+_desugarSomeBehaviors: function (behaviors) {
+behaviors = this._flattenBehaviorsList(behaviors);
+for (var i = behaviors.length - 1; i >= 0; i--) {
+this._mixinBehavior(behaviors[i]);
+}
+return behaviors;
},
_flattenBehaviorsList: function (behaviors) {
var flat = [];
@@ -291,15 +304,6 @@ this._warn(this._logf('_flattenBehaviorsList', 'behavior is null, check for miss
}, this);
return flat;
},
-_prepAllBehaviors: function (behaviors) {
-for (var i = behaviors.length - 1; i >= 0; i--) {
-this._mixinBehavior(behaviors[i]);
-}
-for (var i = 0, l = behaviors.length; i < l; i++) {
-this._prepBehavior(behaviors[i]);
-}
-this._prepBehavior(this);
-},
_mixinBehavior: function (b) {
Object.getOwnPropertyNames(b).forEach(function (n) {
switch (n) {
@@ -323,6 +327,15 @@ break;
}
}, this);
},
+_prepBehaviors: function () {
+this._prepFlattenedBehaviors(this.behaviors);
+},
+_prepFlattenedBehaviors: function (behaviors) {
+for (var i = 0, l = behaviors.length; i < l; i++) {
+this._prepBehavior(behaviors[i]);
+}
+this._prepBehavior(this);
+},
_doBehavior: function (name, args) {
this.behaviors.forEach(function (b) {
this._invokeBehavior(b, name, args);
@@ -555,7 +568,7 @@ debouncer.stop();
}
}
});
-Polymer.version = '1.0.9';
+Polymer.version = '1.1.3';
Polymer.Base._addFeature({
_registerFeatures: function () {
this._prepIs();

Powered by Google App Engine
This is Rietveld 408576698