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

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

Issue 1187823002: Update Polymer components and re-run reproduce.sh (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 6 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 5351ce89f484b83413f97160cc5e5a670e525508..7b7b84d7e279f7a8829c1ff661f2df8af0a17c0c 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
@@ -1,9 +1,9 @@
-(function() {
+(function () {
function resolve() {
-document.body.removeAttribute("unresolved");
+document.body.removeAttribute('unresolved');
}
if (window.WebComponents) {
-addEventListener("WebComponentsReady", resolve);
+addEventListener('WebComponentsReady', resolve);
} else {
if (document.readyState === 'interactive' || document.readyState === 'complete') {
resolve();
@@ -11,20 +11,19 @@ resolve();
addEventListener('DOMContentLoaded', resolve);
}
}
-})();
-
+}());
Polymer = {
-Settings: function() {
+Settings: function () {
var user = window.Polymer || {};
-location.search.slice(1).split("&").forEach(function(o) {
-o = o.split("=");
+location.search.slice(1).split('&').forEach(function (o) {
+o = o.split('=');
o[0] && (user[o[0]] = o[1] || true);
});
-var wantShadow = user.dom === "shadow";
+var wantShadow = user.dom === 'shadow';
var hasShadow = Boolean(Element.prototype.createShadowRoot);
var nativeShadow = hasShadow && !window.ShadowDOMPolyfill;
var useShadow = wantShadow && hasShadow;
-var hasNativeImports = Boolean("import" in document.createElement("link"));
+var hasNativeImports = Boolean('import' in document.createElement('link'));
var useNativeImports = hasNativeImports;
var useNativeCustomElements = !window.CustomElements || window.CustomElements.useNative;
return {
@@ -38,15 +37,12 @@ useNativeCustomElements: useNativeCustomElements
};
}()
};
-
-(function() {
+(function () {
var userPolymer = window.Polymer;
-window.Polymer = function(prototype) {
+window.Polymer = function (prototype) {
var ctor = desugar(prototype);
prototype = ctor.prototype;
-var options = {
-prototype: prototype
-};
+var options = { prototype: prototype };
if (prototype.extends) {
options.extends = prototype.extends;
}
@@ -54,7 +50,7 @@ Polymer.telemetry._registrate(prototype);
document.registerElement(prototype.is, options);
return ctor;
};
-var desugar = function(prototype) {
+var desugar = function (prototype) {
prototype = Polymer.Base.chainObject(prototype, Polymer.Base);
prototype.registerCallback();
return prototype.constructor;
@@ -66,65 +62,62 @@ Polymer[i] = userPolymer[i];
}
}
Polymer.Class = desugar;
-})();
-
+}());
Polymer.telemetry = {
registrations: [],
-_regLog: function(prototype) {
-console.log("[" + prototype.is + "]: registered");
+_regLog: function (prototype) {
+console.log('[' + prototype.is + ']: registered');
},
-_registrate: function(prototype) {
+_registrate: function (prototype) {
this.registrations.push(prototype);
Polymer.log && this._regLog(prototype);
},
-dumpRegistrations: function() {
+dumpRegistrations: function () {
this.registrations.forEach(this._regLog);
}
};
-
-Object.defineProperty(window, "currentImport", {
+Object.defineProperty(window, 'currentImport', {
enumerable: true,
configurable: true,
-get: function() {
+get: function () {
return (document._currentScript || document.currentScript).ownerDocument;
}
});
-
Polymer.Base = {
-_addFeature: function(feature) {
+_addFeature: function (feature) {
this.extend(this, feature);
},
-registerCallback: function() {
+registerCallback: function () {
this._registerFeatures();
-this._doBehavior("registered");
+this._doBehavior('registered');
},
-createdCallback: function() {
+createdCallback: function () {
Polymer.telemetry.instanceCount++;
this.root = this;
-this._doBehavior("created");
+this._doBehavior('created');
this._initFeatures();
},
-attachedCallback: function() {
+attachedCallback: function () {
this.isAttached = true;
-this._doBehavior("attached");
+this._doBehavior('attached');
},
-detachedCallback: function() {
+detachedCallback: function () {
this.isAttached = false;
-this._doBehavior("detached");
+this._doBehavior('detached');
},
-attributeChangedCallback: function(name) {
+attributeChangedCallback: function (name) {
this._setAttributeToProperty(this, name);
-this._doBehavior("attributeChanged", arguments);
+this._doBehavior('attributeChanged', arguments);
},
-extend: function(prototype, api) {
+extend: function (prototype, api) {
if (prototype && api) {
-Object.getOwnPropertyNames(api).forEach(function(n) {
+Object.getOwnPropertyNames(api).forEach(function (n) {
this.copyOwnProperty(n, api, prototype);
}, this);
}
return prototype || api;
},
-copyOwnProperty: function(name, source, target) {
+copyOwnProperty: function (name, source, target) {
var pd = Object.getOwnPropertyDescriptor(source, name);
if (pd) {
Object.defineProperty(target, name, pd);
@@ -133,17 +126,18 @@ Object.defineProperty(target, name, pd);
_log: console.log.apply.bind(console.log, console),
_warn: console.warn.apply.bind(console.warn, console),
_error: console.error.apply.bind(console.error, console),
-_logf: function() {
-return this._logPrefix.concat([ this.is ]).concat(Array.prototype.slice.call(arguments, 0));
+_logf: function () {
+return this._logPrefix.concat([this.is]).concat(Array.prototype.slice.call(arguments, 0));
}
};
-
-Polymer.Base._logPrefix = function() {
+Polymer.Base._logPrefix = function () {
var color = window.chrome || /firefox/i.test(navigator.userAgent);
-return color ? [ "%c[%s::%s]:", "font-weight: bold; background-color:#EEEE00;" ] : [ "[%s::%s]:" ];
+return color ? [
+'%c[%s::%s]:',
+'font-weight: bold; background-color:#EEEE00;'
+] : ['[%s::%s]:'];
}();
-
-Polymer.Base.chainObject = function(object, inherited) {
+Polymer.Base.chainObject = function (object, inherited) {
if (object && inherited && object !== inherited) {
if (!Object.__proto__) {
object = Polymer.Base.extend(Object.create(inherited), object);
@@ -152,26 +146,23 @@ object.__proto__ = inherited;
}
return object;
};
-
Polymer.Base = Polymer.Base.chainObject(Polymer.Base, HTMLElement.prototype);
-
Polymer.telemetry.instanceCount = 0;
-
-(function() {
+(function () {
var modules = {};
-var DomModule = function() {
-return document.createElement("dom-module");
+var DomModule = function () {
+return document.createElement('dom-module');
};
DomModule.prototype = Object.create(HTMLElement.prototype);
DomModule.prototype.constructor = DomModule;
-DomModule.prototype.createdCallback = function() {
-var id = this.id || this.getAttribute("name") || this.getAttribute("is");
+DomModule.prototype.createdCallback = function () {
+var id = this.id || this.getAttribute('name') || this.getAttribute('is');
if (id) {
this.id = id;
modules[id] = this;
}
};
-DomModule.prototype.import = function(id, slctr) {
+DomModule.prototype.import = function (id, slctr) {
var m = modules[id];
if (!m) {
forceDocumentUpgrade();
@@ -187,7 +178,7 @@ if (cePolyfill) {
var ready = CustomElements.ready;
CustomElements.ready = true;
}
-document.registerElement("dom-module", DomModule);
+document.registerElement('dom-module', DomModule);
if (cePolyfill) {
CustomElements.ready = ready;
}
@@ -199,42 +190,40 @@ CustomElements.upgradeAll(script.ownerDocument);
}
}
}
-})();
-
+}());
Polymer.Base._addFeature({
-_prepIs: function() {
+_prepIs: function () {
if (!this.is) {
var module = (document._currentScript || document.currentScript).parentNode;
-if (module.localName === "dom-module") {
-var id = module.id || module.getAttribute("name") || module.getAttribute("is");
+if (module.localName === 'dom-module') {
+var id = module.id || module.getAttribute('name') || module.getAttribute('is');
this.is = id;
}
}
}
});
-
Polymer.Base._addFeature({
behaviors: [],
-_prepBehaviors: function() {
+_prepBehaviors: function () {
if (this.behaviors.length) {
this.behaviors = this._flattenBehaviorsList(this.behaviors);
}
this._prepAllBehaviors(this.behaviors);
},
-_flattenBehaviorsList: function(behaviors) {
+_flattenBehaviorsList: function (behaviors) {
var flat = [];
-behaviors.forEach(function(b) {
+behaviors.forEach(function (b) {
if (b instanceof Array) {
flat = flat.concat(this._flattenBehaviorsList(b));
} else if (b) {
flat.push(b);
} else {
-this._warn(this._logf("_flattenBehaviorsList", "behavior is null, check for missing or 404 import"));
+this._warn(this._logf('_flattenBehaviorsList', 'behavior is null, check for missing or 404 import'));
}
}, this);
return flat;
},
-_prepAllBehaviors: function(behaviors) {
+_prepAllBehaviors: function (behaviors) {
for (var i = behaviors.length - 1; i >= 0; i--) {
this._mixinBehavior(behaviors[i]);
}
@@ -243,22 +232,21 @@ this._prepBehavior(behaviors[i]);
}
this._prepBehavior(this);
},
-_mixinBehavior: function(b) {
-Object.getOwnPropertyNames(b).forEach(function(n) {
+_mixinBehavior: function (b) {
+Object.getOwnPropertyNames(b).forEach(function (n) {
switch (n) {
-case "hostAttributes":
-case "registered":
-case "properties":
-case "observers":
-case "listeners":
-case "created":
-case "attached":
-case "detached":
-case "attributeChanged":
-case "configure":
-case "ready":
+case 'hostAttributes':
+case 'registered':
+case 'properties':
+case 'observers':
+case 'listeners':
+case 'created':
+case 'attached':
+case 'detached':
+case 'attributeChanged':
+case 'configure':
+case 'ready':
break;
-
default:
if (!this.hasOwnProperty(n)) {
this.copyOwnProperty(n, b, this);
@@ -267,37 +255,36 @@ break;
}
}, this);
},
-_doBehavior: function(name, args) {
-this.behaviors.forEach(function(b) {
+_doBehavior: function (name, args) {
+this.behaviors.forEach(function (b) {
this._invokeBehavior(b, name, args);
}, this);
this._invokeBehavior(this, name, args);
},
-_invokeBehavior: function(b, name, args) {
+_invokeBehavior: function (b, name, args) {
var fn = b[name];
if (fn) {
fn.apply(this, args || Polymer.nar);
}
},
-_marshalBehaviors: function() {
-this.behaviors.forEach(function(b) {
+_marshalBehaviors: function () {
+this.behaviors.forEach(function (b) {
this._marshalBehavior(b);
}, this);
this._marshalBehavior(this);
}
});
-
Polymer.Base._addFeature({
-_prepExtends: function() {
+_prepExtends: function () {
if (this.extends) {
this.__proto__ = this._getExtendedPrototype(this.extends);
}
},
-_getExtendedPrototype: function(tag) {
+_getExtendedPrototype: function (tag) {
return this._getExtendedNativePrototype(tag);
},
_nativePrototypes: {},
-_getExtendedNativePrototype: function(tag) {
+_getExtendedNativePrototype: function (tag) {
var p = this._nativePrototypes[tag];
if (!p) {
var np = this.getNativePrototype(tag);
@@ -306,28 +293,30 @@ this._nativePrototypes[tag] = p;
}
return p;
},
-getNativePrototype: function(tag) {
+getNativePrototype: function (tag) {
return Object.getPrototypeOf(document.createElement(tag));
}
});
-
Polymer.Base._addFeature({
-_prepConstructor: function() {
-this._factoryArgs = this.extends ? [ this.extends, this.is ] : [ this.is ];
-var ctor = function() {
+_prepConstructor: function () {
+this._factoryArgs = this.extends ? [
+this.extends,
+this.is
+] : [this.is];
+var ctor = function () {
return this._factory(arguments);
};
-if (this.hasOwnProperty("extends")) {
+if (this.hasOwnProperty('extends')) {
ctor.extends = this.extends;
}
-Object.defineProperty(this, "constructor", {
+Object.defineProperty(this, 'constructor', {
value: ctor,
writable: true,
configurable: true
});
ctor.prototype = this;
},
-_factory: function(args) {
+_factory: function (args) {
var elt = document.createElement.apply(document, this._factoryArgs);
if (this.factoryImpl) {
this.factoryImpl.apply(elt, args);
@@ -335,26 +324,22 @@ this.factoryImpl.apply(elt, args);
return elt;
}
});
-
Polymer.nob = Object.create(null);
-
Polymer.Base._addFeature({
properties: {},
-getPropertyInfo: function(property) {
+getPropertyInfo: function (property) {
var info = this._getPropertyInfo(property, this.properties);
if (!info) {
-this.behaviors.some(function(b) {
+this.behaviors.some(function (b) {
return info = this._getPropertyInfo(property, b.properties);
}, this);
}
return info || Polymer.nob;
},
-_getPropertyInfo: function(property, properties) {
+_getPropertyInfo: function (property, properties) {
var p = properties && properties[property];
-if (typeof p === "function") {
-p = properties[property] = {
-type: p
-};
+if (typeof p === 'function') {
+p = properties[property] = { type: p };
}
if (p) {
p.defined = true;
@@ -362,60 +347,58 @@ p.defined = true;
return p;
}
});
-
Polymer.CaseMap = {
_caseMap: {},
-dashToCamelCase: function(dash) {
+dashToCamelCase: function (dash) {
var mapped = Polymer.CaseMap._caseMap[dash];
if (mapped) {
return mapped;
}
-if (dash.indexOf("-") < 0) {
+if (dash.indexOf('-') < 0) {
return Polymer.CaseMap._caseMap[dash] = dash;
}
-return Polymer.CaseMap._caseMap[dash] = dash.replace(/-([a-z])/g, function(m) {
+return Polymer.CaseMap._caseMap[dash] = dash.replace(/-([a-z])/g, function (m) {
return m[1].toUpperCase();
});
},
-camelToDashCase: function(camel) {
+camelToDashCase: function (camel) {
var mapped = Polymer.CaseMap._caseMap[camel];
if (mapped) {
return mapped;
}
-return Polymer.CaseMap._caseMap[camel] = camel.replace(/([a-z][A-Z])/g, function(g) {
-return g[0] + "-" + g[1].toLowerCase();
+return Polymer.CaseMap._caseMap[camel] = camel.replace(/([a-z][A-Z])/g, function (g) {
+return g[0] + '-' + g[1].toLowerCase();
});
}
};
-
Polymer.Base._addFeature({
-_prepAttributes: function() {
+_prepAttributes: function () {
this._aggregatedAttributes = {};
},
-_addHostAttributes: function(attributes) {
+_addHostAttributes: function (attributes) {
if (attributes) {
this.mixin(this._aggregatedAttributes, attributes);
}
},
-_marshalHostAttributes: function() {
+_marshalHostAttributes: function () {
this._applyAttributes(this, this._aggregatedAttributes);
},
-_applyAttributes: function(node, attr$) {
+_applyAttributes: function (node, attr$) {
for (var n in attr$) {
-if (!this.hasAttribute(n) && n !== "class") {
+if (!this.hasAttribute(n) && n !== 'class') {
this.serializeValueToAttribute(attr$[n], n, this);
}
}
},
-_marshalAttributes: function() {
+_marshalAttributes: function () {
this._takeAttributesToModel(this);
},
-_takeAttributesToModel: function(model) {
+_takeAttributesToModel: function (model) {
for (var i = 0, l = this.attributes.length; i < l; i++) {
this._setAttributeToProperty(model, this.attributes[i].name);
}
},
-_setAttributeToProperty: function(model, attrName) {
+_setAttributeToProperty: function (model, attrName) {
if (!this._serializing) {
var propName = Polymer.CaseMap.dashToCamelCase(attrName);
var info = this.getPropertyInfo(propName);
@@ -426,112 +409,104 @@ model[propName] = this.deserialize(val, info.type);
}
},
_serializing: false,
-reflectPropertyToAttribute: function(name) {
+reflectPropertyToAttribute: function (name) {
this._serializing = true;
this.serializeValueToAttribute(this[name], Polymer.CaseMap.camelToDashCase(name));
this._serializing = false;
},
-serializeValueToAttribute: function(value, attribute, node) {
+serializeValueToAttribute: function (value, attribute, node) {
var str = this.serialize(value);
-(node || this)[str === undefined ? "removeAttribute" : "setAttribute"](attribute, str);
+(node || this)[str === undefined ? 'removeAttribute' : 'setAttribute'](attribute, str);
},
-deserialize: function(value, type) {
+deserialize: function (value, type) {
switch (type) {
case Number:
value = Number(value);
break;
-
case Boolean:
value = value !== null;
break;
-
case Object:
try {
value = JSON.parse(value);
-} catch (x) {}
+} catch (x) {
+}
break;
-
case Array:
try {
value = JSON.parse(value);
} catch (x) {
value = null;
-console.warn("Polymer::Attributes: couldn`t decode Array as JSON");
+console.warn('Polymer::Attributes: couldn`t decode Array as JSON');
}
break;
-
case Date:
value = new Date(value);
break;
-
case String:
default:
break;
}
return value;
},
-serialize: function(value) {
+serialize: function (value) {
switch (typeof value) {
-case "boolean":
-return value ? "" : undefined;
-
-case "object":
+case 'boolean':
+return value ? '' : undefined;
+case 'object':
if (value instanceof Date) {
return value;
} else if (value) {
try {
return JSON.stringify(value);
} catch (x) {
-return "";
+return '';
}
}
-
default:
return value != null ? value : undefined;
}
}
});
-
Polymer.Base._addFeature({
-_setupDebouncers: function() {
+_setupDebouncers: function () {
this._debouncers = {};
},
-debounce: function(jobName, callback, wait) {
+debounce: function (jobName, callback, wait) {
this._debouncers[jobName] = Polymer.Debounce.call(this, this._debouncers[jobName], callback, wait);
},
-isDebouncerActive: function(jobName) {
+isDebouncerActive: function (jobName) {
var debouncer = this._debouncers[jobName];
return debouncer && debouncer.finish;
},
-flushDebouncer: function(jobName) {
+flushDebouncer: function (jobName) {
var debouncer = this._debouncers[jobName];
if (debouncer) {
debouncer.complete();
}
},
-cancelDebouncer: function(jobName) {
+cancelDebouncer: function (jobName) {
var debouncer = this._debouncers[jobName];
if (debouncer) {
debouncer.stop();
}
}
});
-
-Polymer.version = "1.0.2";
-
+Polymer.version = '1.0.3';
Polymer.Base._addFeature({
-_registerFeatures: function() {
+_registerFeatures: function () {
this._prepIs();
this._prepAttributes();
this._prepBehaviors();
this._prepExtends();
this._prepConstructor();
},
-_prepBehavior: function(b) {
+_prepBehavior: function (b) {
this._addHostAttributes(b.hostAttributes);
},
-_marshalBehavior: function(b) {},
-_initFeatures: function() {
+_marshalBehavior: function (b) {
+},
+_initFeatures: function () {
this._marshalHostAttributes();
this._setupDebouncers();
this._marshalBehaviors();

Powered by Google App Engine
This is Rietveld 408576698