| Index: third_party/polymer/v1_0/components-chromium/polymer/polymer-extracted.js
|
| diff --git a/third_party/polymer/v1_0/components-chromium/polymer/polymer-extracted.js b/third_party/polymer/v1_0/components-chromium/polymer/polymer-extracted.js
|
| index 5d493761bab52fd582698512fe190c726d1abaf0..b40fbcd87e13b74e89db7029cfc7aad5f5970775 100644
|
| --- a/third_party/polymer/v1_0/components-chromium/polymer/polymer-extracted.js
|
| +++ b/third_party/polymer/v1_0/components-chromium/polymer/polymer-extracted.js
|
| @@ -10,7 +10,7 @@ _parseNodeAnnotations: function (node, list, stripWhiteSpace) {
|
| return node.nodeType === Node.TEXT_NODE ? this._parseTextNodeAnnotation(node, list) : this._parseElementAnnotations(node, list, stripWhiteSpace);
|
| },
|
| _bindingRegex: function () {
|
| -var IDENT = '(?:' + '[a-zA-Z_$][\\w.:$-*]*' + ')';
|
| +var IDENT = '(?:' + '[a-zA-Z_$][\\w.:$\\-*]*' + ')';
|
| var NUMBER = '(?:' + '[-+]?[0-9]*\\.?[0-9]+(?:[eE][-+]?[0-9]+)?' + ')';
|
| var SQUOTE_STRING = '(?:' + '\'(?:[^\'\\\\]|\\\\.)*\'' + ')';
|
| var DQUOTE_STRING = '(?:' + '"(?:[^"\\\\]|\\\\.)*"' + ')';
|
| @@ -189,12 +189,14 @@ if (node.localName === 'input' && origName === 'value') {
|
| node.setAttribute(origName, '');
|
| }
|
| node.removeAttribute(origName);
|
| +var propertyName = Polymer.CaseMap.dashToCamelCase(name);
|
| if (kind === 'property') {
|
| -name = Polymer.CaseMap.dashToCamelCase(name);
|
| +name = propertyName;
|
| }
|
| return {
|
| kind: kind,
|
| name: name,
|
| +propertyName: propertyName,
|
| parts: parts,
|
| literal: literal,
|
| isCompound: parts.length !== 1
|
| @@ -299,8 +301,10 @@ var b = note.bindings[j];
|
| for (var k = 0; k < b.parts.length; k++) {
|
| var p = b.parts[k];
|
| if (!p.literal) {
|
| -p.signature = this._parseMethod(p.value);
|
| -if (!p.signature) {
|
| +var signature = this._parseMethod(p.value);
|
| +if (signature) {
|
| +p.signature = signature;
|
| +} else {
|
| p.model = this._modelForPath(p.value);
|
| }
|
| }
|
| @@ -364,7 +368,7 @@ this._marshalAnnotatedNodes();
|
| this._marshalAnnotatedListeners();
|
| }
|
| },
|
| -_configureAnnotationReferences: function (config) {
|
| +_configureAnnotationReferences: function () {
|
| var notes = this._notes;
|
| var nodes = this._nodes;
|
| for (var i = 0; i < notes.length; i++) {
|
| @@ -693,7 +697,7 @@ if (type === 'touchstart' || type === 'touchmove') {
|
| Gestures.handleTouchAction(ev);
|
| }
|
| }
|
| -if (type === 'touchend') {
|
| +if (type === 'touchend' && !ev.__polymerSimulatedTouch) {
|
| POINTERSTATE.mouse.target = Polymer.dom(ev).rootTarget;
|
| ignoreMouse(true);
|
| }
|
| @@ -707,14 +711,12 @@ var recognizers = Gestures.recognizers;
|
| for (var i = 0, r; i < recognizers.length; i++) {
|
| r = recognizers[i];
|
| if (gs[r.name] && !handled[r.name]) {
|
| -if (r.flow && r.flow.start.indexOf(ev.type) > -1) {
|
| -if (r.reset) {
|
| +if (r.flow && r.flow.start.indexOf(ev.type) > -1 && r.reset) {
|
| r.reset();
|
| }
|
| }
|
| }
|
| -}
|
| -for (var i = 0, r; i < recognizers.length; i++) {
|
| +for (i = 0, r; i < recognizers.length; i++) {
|
| r = recognizers[i];
|
| if (gs[r.name] && !handled[r.name]) {
|
| handled[r.name] = true;
|
| @@ -979,6 +981,9 @@ var movefn = function movefn(e) {
|
| var x = e.clientX, y = e.clientY;
|
| if (self.hasMovedEnough(x, y)) {
|
| self.info.state = self.info.started ? e.type === 'mouseup' ? 'end' : 'track' : 'start';
|
| +if (self.info.state === 'start') {
|
| +Gestures.prevent('tap');
|
| +}
|
| self.info.addMove({
|
| x: x,
|
| y: y
|
| @@ -993,7 +998,6 @@ self.info.started = true;
|
| };
|
| var upfn = function upfn(e) {
|
| if (self.info.started) {
|
| -Gestures.prevent('tap');
|
| movefn(e);
|
| }
|
| untrackDocument(self.info);
|
| @@ -1012,6 +1016,9 @@ var t = Gestures.findOriginalTarget(e);
|
| var ct = e.changedTouches[0];
|
| var x = ct.clientX, y = ct.clientY;
|
| if (this.hasMovedEnough(x, y)) {
|
| +if (this.info.state === 'start') {
|
| +Gestures.prevent('tap');
|
| +}
|
| this.info.addMove({
|
| x: x,
|
| y: y
|
| @@ -1025,7 +1032,6 @@ touchend: function (e) {
|
| var t = Gestures.findOriginalTarget(e);
|
| var ct = e.changedTouches[0];
|
| if (this.info.started) {
|
| -Gestures.prevent('tap');
|
| this.info.state = 'end';
|
| this.info.addMove({
|
| x: ct.clientX,
|
| @@ -1234,7 +1240,7 @@ return n.nodeType === Node.ELEMENT_NODE;
|
| fire: function (type, detail, options) {
|
| options = options || Polymer.nob;
|
| var node = options.node || this;
|
| -var detail = detail === null || detail === undefined ? {} : detail;
|
| +detail = detail === null || detail === undefined ? {} : detail;
|
| var bubbles = options.bubbles === undefined ? true : options.bubbles;
|
| var cancelable = Boolean(options.cancelable);
|
| var useCache = options._useCache;
|
| @@ -1418,7 +1424,7 @@ _sortPropertyEffects: function () {
|
| var EFFECT_ORDER = {
|
| 'compute': 0,
|
| 'annotation': 1,
|
| -'computedAnnotation': 2,
|
| +'annotatedComputation': 2,
|
| 'reflect': 3,
|
| 'notify': 4,
|
| 'observer': 5,
|
| @@ -1451,11 +1457,11 @@ Object.defineProperty(model, property, defun);
|
| upper: function (name) {
|
| return name[0].toUpperCase() + name.substring(1);
|
| },
|
| -_addAnnotatedListener: function (model, index, property, path, event) {
|
| +_addAnnotatedListener: function (model, index, property, path, event, negated) {
|
| if (!model._bindListeners) {
|
| model._bindListeners = [];
|
| }
|
| -var fn = this._notedListenerFactory(property, path, this._isStructured(path));
|
| +var fn = this._notedListenerFactory(property, path, this._isStructured(path), negated);
|
| var eventName = event || Polymer.CaseMap.camelToDashCase(property) + '-changed';
|
| model._bindListeners.push({
|
| index: index,
|
| @@ -1471,12 +1477,15 @@ return path.indexOf('.') > 0;
|
| _isEventBogus: function (e, target) {
|
| return e.path && e.path[0] !== target;
|
| },
|
| -_notedListenerFactory: function (property, path, isStructured) {
|
| +_notedListenerFactory: function (property, path, isStructured, negated) {
|
| return function (target, value, targetPath) {
|
| if (targetPath) {
|
| this._notifyPath(this._fixPath(path, property, targetPath), value);
|
| } else {
|
| value = target[property];
|
| +if (negated) {
|
| +value = !value;
|
| +}
|
| if (!isStructured) {
|
| this[path] = value;
|
| } else {
|
| @@ -1496,7 +1505,6 @@ for (var i = 0, l = b$.length, info; i < l && (info = b$[i]); i++) {
|
| var node = inst._nodes[info.index];
|
| this._addNotifyListener(node, inst, info.event, info.changedFn);
|
| }
|
| -;
|
| },
|
| _addNotifyListener: function (element, context, event, changedFn) {
|
| element.addEventListener(event, function (e) {
|
| @@ -1506,7 +1514,7 @@ return context._notifyListener(changedFn, e);
|
| };
|
| Polymer.Base.extend(Polymer.Bind, {
|
| _shouldAddListener: function (effect) {
|
| -return effect.name && effect.kind != 'attribute' && effect.kind != 'text' && !effect.isCompound && effect.parts[0].mode === '{' && !effect.parts[0].negate;
|
| +return effect.name && effect.kind != 'attribute' && effect.kind != 'text' && !effect.isCompound && effect.parts[0].mode === '{';
|
| },
|
| _annotationEffect: function (source, value, effect) {
|
| if (source != effect.value) {
|
| @@ -1544,20 +1552,23 @@ var args = Polymer.Bind._marshalArgs(this.__data__, effect, source, value);
|
| if (args) {
|
| fn.apply(this, args);
|
| }
|
| +} else if (effect.dynamicFn) {
|
| } else {
|
| this._warn(this._logf('_complexObserverEffect', 'observer method `' + effect.method + '` not defined'));
|
| }
|
| },
|
| _computeEffect: function (source, value, effect) {
|
| -var args = Polymer.Bind._marshalArgs(this.__data__, effect, source, value);
|
| -if (args) {
|
| var fn = this[effect.method];
|
| if (fn) {
|
| -this.__setProperty(effect.name, fn.apply(this, args));
|
| +var args = Polymer.Bind._marshalArgs(this.__data__, effect, source, value);
|
| +if (args) {
|
| +var computedvalue = fn.apply(this, args);
|
| +this.__setProperty(effect.name, computedvalue);
|
| +}
|
| +} else if (effect.dynamicFn) {
|
| } else {
|
| this._warn(this._logf('_computeEffect', 'compute method `' + effect.method + '` not defined'));
|
| }
|
| -}
|
| },
|
| _annotatedComputationEffect: function (source, value, effect) {
|
| var computedHost = this._rootDataHost || this;
|
| @@ -1571,6 +1582,7 @@ computedvalue = !computedvalue;
|
| }
|
| this._applyEffectValue(effect, computedvalue);
|
| }
|
| +} else if (effect.dynamicFn) {
|
| } else {
|
| computedHost._warn(computedHost._logf('_annotatedComputationEffect', 'compute method `' + effect.method + '` not defined'));
|
| }
|
| @@ -1578,6 +1590,7 @@ computedHost._warn(computedHost._logf('_annotatedComputationEffect', 'compute me
|
| _marshalArgs: function (model, effect, path, value) {
|
| var values = [];
|
| var args = effect.args;
|
| +var bailoutEarly = args.length > 1 || effect.dynamicFn;
|
| for (var i = 0, l = args.length; i < l; i++) {
|
| var arg = args[i];
|
| var name = arg.name;
|
| @@ -1589,7 +1602,7 @@ v = Polymer.Base._get(name, model);
|
| } else {
|
| v = model[name];
|
| }
|
| -if (args.length > 1 && v === undefined) {
|
| +if (bailoutEarly && v === undefined) {
|
| return;
|
| }
|
| if (arg.wildcard) {
|
| @@ -1644,12 +1657,23 @@ Polymer.Bind.ensurePropertyEffects(this, p);
|
| },
|
| _addComputedEffect: function (name, expression) {
|
| var sig = this._parseMethod(expression);
|
| +var dynamicFn = sig.dynamicFn;
|
| for (var i = 0, arg; i < sig.args.length && (arg = sig.args[i]); i++) {
|
| this._addPropertyEffect(arg.model, 'compute', {
|
| method: sig.method,
|
| args: sig.args,
|
| trigger: arg,
|
| -name: name
|
| +name: name,
|
| +dynamicFn: dynamicFn
|
| +});
|
| +}
|
| +if (dynamicFn) {
|
| +this._addPropertyEffect(sig.method, 'compute', {
|
| +method: sig.method,
|
| +args: sig.args,
|
| +trigger: null,
|
| +name: name,
|
| +dynamicFn: dynamicFn
|
| });
|
| }
|
| },
|
| @@ -1671,11 +1695,21 @@ var sig = this._parseMethod(observer);
|
| if (!sig) {
|
| throw new Error('Malformed observer expression \'' + observer + '\'');
|
| }
|
| +var dynamicFn = sig.dynamicFn;
|
| for (var i = 0, arg; i < sig.args.length && (arg = sig.args[i]); i++) {
|
| this._addPropertyEffect(arg.model, 'complexObserver', {
|
| method: sig.method,
|
| args: sig.args,
|
| -trigger: arg
|
| +trigger: arg,
|
| +dynamicFn: dynamicFn
|
| +});
|
| +}
|
| +if (dynamicFn) {
|
| +this._addPropertyEffect(sig.method, 'complexObserver', {
|
| +method: sig.method,
|
| +args: sig.args,
|
| +trigger: null,
|
| +dynamicFn: dynamicFn
|
| });
|
| }
|
| },
|
| @@ -1689,7 +1723,7 @@ this._addAnnotationEffect(binding, i);
|
| },
|
| _addAnnotationEffect: function (note, index) {
|
| if (Polymer.Bind._shouldAddListener(note)) {
|
| -Polymer.Bind._addAnnotatedListener(this, index, note.name, note.parts[0].value, note.parts[0].event);
|
| +Polymer.Bind._addAnnotatedListener(this, index, note.name, note.parts[0].value, note.parts[0].event, note.parts[0].negate);
|
| }
|
| for (var i = 0; i < note.parts.length; i++) {
|
| var part = note.parts[i];
|
| @@ -1700,6 +1734,7 @@ this._addPropertyEffect(part.model, 'annotation', {
|
| kind: note.kind,
|
| index: index,
|
| name: note.name,
|
| +propertyName: note.propertyName,
|
| value: part.value,
|
| isCompound: note.isCompound,
|
| compoundIndex: part.compoundIndex,
|
| @@ -1720,6 +1755,9 @@ if (!arg.literal) {
|
| this.__addAnnotatedComputationEffect(arg.model, index, note, part, arg);
|
| }
|
| }
|
| +if (sig.dynamicFn) {
|
| +this.__addAnnotatedComputationEffect(sig.method, index, note, part, null);
|
| +}
|
| }
|
| },
|
| __addAnnotatedComputationEffect: function (property, index, note, part, trigger) {
|
| @@ -1732,16 +1770,21 @@ name: note.name,
|
| negate: part.negate,
|
| method: part.signature.method,
|
| args: part.signature.args,
|
| -trigger: trigger
|
| +trigger: trigger,
|
| +dynamicFn: part.signature.dynamicFn
|
| });
|
| },
|
| _parseMethod: function (expression) {
|
| -var m = expression.match(/([^\s]+?)\((.*)\)/);
|
| +var m = expression.match(/([^\s]+?)\(([\s\S]*)\)/);
|
| if (m) {
|
| var sig = {
|
| method: m[1],
|
| static: true
|
| };
|
| +if (this.getPropertyInfo(sig.method) !== Polymer.nob) {
|
| +sig.static = false;
|
| +sig.dynamicFn = true;
|
| +}
|
| if (m[2].trim()) {
|
| var args = m[2].replace(/\\,/g, ',').split(',');
|
| return this._parseArgs(args, sig);
|
| @@ -1829,6 +1872,8 @@ this._effectEffects('__static__', null, this._propertyEffects.__static__);
|
| }
|
| }
|
| });
|
| +(function () {
|
| +var usePolyfillProto = Polymer.Settings.usePolyfillProto;
|
| Polymer.Base._addFeature({
|
| _setupConfigure: function (initialConfig) {
|
| this._config = {};
|
| @@ -1875,7 +1920,10 @@ this._distributeConfig(this._config);
|
| _configureProperties: function (properties, config) {
|
| for (var i in properties) {
|
| var c = properties[i];
|
| -if (c.value !== undefined) {
|
| +if (!usePolyfillProto && this.hasOwnProperty(i) && this._propertyEffects && this._propertyEffects[i]) {
|
| +config[i] = this[i];
|
| +delete this[i];
|
| +} else if (c.value !== undefined) {
|
| var value = c.value;
|
| if (typeof value == 'function') {
|
| value = value.call(this, this._config);
|
| @@ -1893,9 +1941,15 @@ if (fx) {
|
| for (var i = 0, l = fx.length, x; i < l && (x = fx[i]); i++) {
|
| if (x.kind === 'annotation' && !x.isCompound) {
|
| var node = this._nodes[x.effect.index];
|
| -if (node._configValue) {
|
| +var name = x.effect.propertyName;
|
| +var isAttr = x.effect.kind == 'attribute';
|
| +var hasEffect = node._propertyEffects && node._propertyEffects[name];
|
| +if (node._configValue && (hasEffect || !isAttr)) {
|
| var value = p === x.effect.value ? config[p] : this._get(x.effect.value, config);
|
| -node._configValue(x.effect.name, value);
|
| +if (isAttr) {
|
| +value = node.deserialize(this.serialize(value), node._propertyInfo[name].type);
|
| +}
|
| +node._configValue(name, value);
|
| }
|
| }
|
| }
|
| @@ -1945,6 +1999,7 @@ h[0].call(this, h[1], h[2], h[3]);
|
| this._handlers = [];
|
| }
|
| });
|
| +}());
|
| (function () {
|
| 'use strict';
|
| Polymer.Base._addFeature({
|
| @@ -2002,14 +2057,15 @@ array = Array.isArray(prop) ? prop : null;
|
| }
|
| if (array) {
|
| var coll = Polymer.Collection.get(array);
|
| +var old, key;
|
| if (last[0] == '#') {
|
| -var key = last;
|
| -var old = coll.getItem(key);
|
| +key = last;
|
| +old = coll.getItem(key);
|
| last = array.indexOf(old);
|
| coll.setItem(key, value);
|
| } else if (parseInt(last, 10) == last) {
|
| -var old = prop[last];
|
| -var key = coll.getKey(old);
|
| +old = prop[last];
|
| +key = coll.getKey(old);
|
| parts[i] = key;
|
| coll.setItem(key, value);
|
| }
|
| @@ -2190,7 +2246,7 @@ this._notifySplice(array, info.path, array.length, 0, [ret]);
|
| }
|
| return ret;
|
| },
|
| -splice: function (path, start, deleteCount) {
|
| +splice: function (path, start) {
|
| var info = {};
|
| var array = this._get(path, this, info);
|
| if (start < 0) {
|
| @@ -2318,6 +2374,7 @@ if (s.indexOf(this.MEDIA_START) === 0) {
|
| node.type = this.types.MEDIA_RULE;
|
| } else if (s.match(this._rx.keyframesRule)) {
|
| node.type = this.types.KEYFRAMES_RULE;
|
| +node.keyframesName = node.selector.split(this._rx.multipleSpaces).pop();
|
| }
|
| } else {
|
| if (s.indexOf(this.VAR_START) === 0) {
|
| @@ -2416,14 +2473,14 @@ if (typeof rules === 'string') {
|
| rules = this.parser.parse(rules);
|
| }
|
| if (callback) {
|
| -this.forEachStyleRule(rules, callback);
|
| +this.forEachRule(rules, callback);
|
| }
|
| return this.parser.stringify(rules, preserveProperties);
|
| },
|
| -forRulesInStyles: function (styles, callback) {
|
| +forRulesInStyles: function (styles, styleRuleCallback, keyframesRuleCallback) {
|
| if (styles) {
|
| for (var i = 0, l = styles.length, s; i < l && (s = styles[i]); i++) {
|
| -this.forEachStyleRule(this.rulesForStyle(s), callback);
|
| +this.forEachRule(this.rulesForStyle(s), styleRuleCallback, keyframesRuleCallback);
|
| }
|
| }
|
| },
|
| @@ -2433,20 +2490,25 @@ style.__cssRules = this.parser.parse(style.textContent);
|
| }
|
| return style.__cssRules;
|
| },
|
| -forEachStyleRule: function (node, callback) {
|
| +isKeyframesSelector: function (rule) {
|
| +return rule.parent && rule.parent.type === this.ruleTypes.KEYFRAMES_RULE;
|
| +},
|
| +forEachRule: function (node, styleRuleCallback, keyframesRuleCallback) {
|
| if (!node) {
|
| return;
|
| }
|
| var skipRules = false;
|
| if (node.type === this.ruleTypes.STYLE_RULE) {
|
| -callback(node);
|
| -} else if (node.type === this.ruleTypes.KEYFRAMES_RULE || node.type === this.ruleTypes.MIXIN_RULE) {
|
| +styleRuleCallback(node);
|
| +} else if (keyframesRuleCallback && node.type === this.ruleTypes.KEYFRAMES_RULE) {
|
| +keyframesRuleCallback(node);
|
| +} else if (node.type === this.ruleTypes.MIXIN_RULE) {
|
| skipRules = true;
|
| }
|
| var r$ = node.rules;
|
| if (r$ && !skipRules) {
|
| for (var i = 0, l = r$.length, r; i < l && (r = r$[i]); i++) {
|
| -this.forEachStyleRule(r, callback);
|
| +this.forEachRule(r, styleRuleCallback, keyframesRuleCallback);
|
| }
|
| }
|
| },
|
| @@ -2595,15 +2657,18 @@ this._transformRule(rule, this._transformComplexSelector, scope, hostScope);
|
| },
|
| _transformRule: function (rule, transformer, scope, hostScope) {
|
| var p$ = rule.selector.split(COMPLEX_SELECTOR_SEP);
|
| +if (!styleUtil.isKeyframesSelector(rule)) {
|
| for (var i = 0, l = p$.length, p; i < l && (p = p$[i]); i++) {
|
| p$[i] = transformer.call(this, p, scope, hostScope);
|
| }
|
| +}
|
| rule.selector = rule.transformedSelector = p$.join(COMPLEX_SELECTOR_SEP);
|
| },
|
| _transformComplexSelector: function (selector, scope, hostScope) {
|
| var stop = false;
|
| var hostContext = false;
|
| var self = this;
|
| +selector = selector.replace(CONTENT_START, HOST + ' $1');
|
| selector = selector.replace(SIMPLE_SELECTOR_SEP, function (m, c, s) {
|
| if (!stop) {
|
| var info = self._transformCompoundSelector(s, c, scope, hostScope);
|
| @@ -2676,10 +2741,10 @@ SCOPE_NAME: 'style-scope'
|
| var SCOPE_NAME = api.SCOPE_NAME;
|
| var SCOPE_DOC_SELECTOR = ':not([' + SCOPE_NAME + '])' + ':not(.' + SCOPE_NAME + ')';
|
| var COMPLEX_SELECTOR_SEP = ',';
|
| -var SIMPLE_SELECTOR_SEP = /(^|[\s>+~]+)([^\s>+~]+)/g;
|
| +var SIMPLE_SELECTOR_SEP = /(^|[\s>+~]+)((?:\[.+?\]|[^\s>+~=\[])+)/g;
|
| var HOST = ':host';
|
| var ROOT = ':root';
|
| -var HOST_PAREN = /(\:host)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/g;
|
| +var HOST_PAREN = /(:host)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/g;
|
| var HOST_CONTEXT = ':host-context';
|
| var HOST_CONTEXT_PAREN = /(.*)(?::host-context)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))(.*)/;
|
| var CONTENT = '::content';
|
| @@ -2689,6 +2754,7 @@ var CSS_ATTR_PREFIX = '[' + SCOPE_NAME + '~=';
|
| var CSS_ATTR_SUFFIX = ']';
|
| var PSEUDO_PREFIX = ':';
|
| var CLASS = 'class';
|
| +var CONTENT_START = new RegExp('^(' + CONTENT + ')');
|
| return api;
|
| }();
|
| Polymer.StyleExtends = function () {
|
| @@ -2700,8 +2766,8 @@ return Boolean(cssText.match(this.rx.EXTEND));
|
| transform: function (style) {
|
| var rules = styleUtil.rulesForStyle(style);
|
| var self = this;
|
| -styleUtil.forEachStyleRule(rules, function (rule) {
|
| -var map = self._mapRule(rule);
|
| +styleUtil.forEachRule(rules, function (rule) {
|
| +self._mapRuleOntoParent(rule);
|
| if (rule.parent) {
|
| var m;
|
| while (m = self.rx.EXTEND.exec(rule.cssText)) {
|
| @@ -2720,7 +2786,7 @@ rule.cssText = '';
|
| }
|
| }, true);
|
| },
|
| -_mapRule: function (rule) {
|
| +_mapRuleOntoParent: function (rule) {
|
| if (rule.parent) {
|
| var map = rule.parent.map || (rule.parent.map = {});
|
| var parts = rule.selector.split(',');
|
| @@ -2782,7 +2848,10 @@ this._encapsulateStyle = !nativeShadow && Boolean(this._template);
|
| if (this._template) {
|
| this._styles = this._collectStyles();
|
| var cssText = styleTransformer.elementStyles(this);
|
| -if (cssText) {
|
| +this._prepStyleProperties();
|
| +var needsStatic = this._styles.length && !this._needsStyleProperties();
|
| +if (needsStatic || !nativeShadow) {
|
| +cssText = needsStatic ? cssText : ' ';
|
| var style = styleUtil.applyCss(cssText, this.is, nativeShadow ? this._template.content : null);
|
| if (!nativeShadow) {
|
| this._scopeStyle = style;
|
| @@ -2873,11 +2942,14 @@ var styleUtil = Polymer.StyleUtil;
|
| var styleTransformer = Polymer.StyleTransformer;
|
| return {
|
| decorateStyles: function (styles) {
|
| -var self = this, props = {};
|
| +var self = this, props = {}, keyframes = [];
|
| styleUtil.forRulesInStyles(styles, function (rule) {
|
| self.decorateRule(rule);
|
| self.collectPropertiesInCssText(rule.propertyInfo.cssText, props);
|
| +}, function onKeyframesRule(rule) {
|
| +keyframes.push(rule);
|
| });
|
| +styles._keyframes = keyframes;
|
| var names = [];
|
| for (var i in props) {
|
| names.push(i);
|
| @@ -2917,17 +2989,10 @@ return any;
|
| }
|
| },
|
| collectCssText: function (rule) {
|
| -var customCssText = '';
|
| -var cssText = rule.parsedCssText;
|
| -cssText = cssText.replace(this.rx.BRACKETED, '').replace(this.rx.VAR_ASSIGN, '');
|
| -var parts = cssText.split(';');
|
| -for (var i = 0, p; i < parts.length; i++) {
|
| -p = parts[i];
|
| -if (p.match(this.rx.MIXIN_MATCH) || p.match(this.rx.VAR_MATCH)) {
|
| -customCssText += p + ';\n';
|
| -}
|
| -}
|
| -return customCssText;
|
| +return this.collectConsumingCssText(rule.parsedCssText);
|
| +},
|
| +collectConsumingCssText: function (cssText) {
|
| +return cssText.replace(this.rx.BRACKETED, '').replace(this.rx.VAR_ASSIGN, '');
|
| },
|
| collectPropertiesInCssText: function (cssText, props) {
|
| var m;
|
| @@ -2969,12 +3034,13 @@ m = p.match(this.rx.MIXIN_MATCH);
|
| if (m) {
|
| p = this.valueForProperty(props[m[1]], props);
|
| } else {
|
| -var pp = p.split(':');
|
| -if (pp[1]) {
|
| -pp[1] = pp[1].trim();
|
| -pp[1] = this.valueForProperty(pp[1], props) || pp[1];
|
| +var colon = p.indexOf(':');
|
| +if (colon !== -1) {
|
| +var pp = p.substring(colon);
|
| +pp = pp.trim();
|
| +pp = this.valueForProperty(pp, props) || pp;
|
| +p = p.substring(0, colon) + pp;
|
| }
|
| -p = pp.join(':');
|
| }
|
| parts[i] = p && p.lastIndexOf(';') === p.length - 1 ? p.slice(0, -1) : p || '';
|
| }
|
| @@ -2991,6 +3057,34 @@ output = this.valueForProperties(rule.propertyInfo.cssText, props);
|
| }
|
| rule.cssText = output;
|
| },
|
| +applyKeyframeTransforms: function (rule, keyframeTransforms) {
|
| +var input = rule.cssText;
|
| +var output = rule.cssText;
|
| +if (rule.hasAnimations == null) {
|
| +rule.hasAnimations = this.rx.ANIMATION_MATCH.test(input);
|
| +}
|
| +if (rule.hasAnimations) {
|
| +var transform;
|
| +if (rule.keyframeNamesToTransform == null) {
|
| +rule.keyframeNamesToTransform = [];
|
| +for (var keyframe in keyframeTransforms) {
|
| +transform = keyframeTransforms[keyframe];
|
| +output = transform(input);
|
| +if (input !== output) {
|
| +input = output;
|
| +rule.keyframeNamesToTransform.push(keyframe);
|
| +}
|
| +}
|
| +} else {
|
| +for (var i = 0; i < rule.keyframeNamesToTransform.length; ++i) {
|
| +transform = keyframeTransforms[rule.keyframeNamesToTransform[i]];
|
| +input = transform(input);
|
| +}
|
| +output = input;
|
| +}
|
| +}
|
| +rule.cssText = output;
|
| +},
|
| propertyDataFromStyles: function (styles, element) {
|
| var props = {}, self = this;
|
| var o = [], i = 0;
|
| @@ -3041,20 +3135,44 @@ var self = this;
|
| var hostSelector = styleTransformer._calcHostScope(element.is, element.extends);
|
| var rxHostSelector = element.extends ? '\\' + hostSelector.slice(0, -1) + '\\]' : hostSelector;
|
| var hostRx = new RegExp(this.rx.HOST_PREFIX + rxHostSelector + this.rx.HOST_SUFFIX);
|
| +var keyframeTransforms = this._elementKeyframeTransforms(element, scopeSelector);
|
| return styleTransformer.elementStyles(element, function (rule) {
|
| self.applyProperties(rule, properties);
|
| -if (rule.cssText && !nativeShadow) {
|
| +if (!nativeShadow && !Polymer.StyleUtil.isKeyframesSelector(rule) && rule.cssText) {
|
| +self.applyKeyframeTransforms(rule, keyframeTransforms);
|
| self._scopeSelector(rule, hostRx, hostSelector, element._scopeCssViaAttr, scopeSelector);
|
| }
|
| });
|
| },
|
| +_elementKeyframeTransforms: function (element, scopeSelector) {
|
| +var keyframesRules = element._styles._keyframes;
|
| +var keyframeTransforms = {};
|
| +if (!nativeShadow && keyframesRules) {
|
| +for (var i = 0, keyframesRule = keyframesRules[i]; i < keyframesRules.length; keyframesRule = keyframesRules[++i]) {
|
| +this._scopeKeyframes(keyframesRule, scopeSelector);
|
| +keyframeTransforms[keyframesRule.keyframesName] = this._keyframesRuleTransformer(keyframesRule);
|
| +}
|
| +}
|
| +return keyframeTransforms;
|
| +},
|
| +_keyframesRuleTransformer: function (keyframesRule) {
|
| +return function (cssText) {
|
| +return cssText.replace(keyframesRule.keyframesNameRx, keyframesRule.transformedKeyframesName);
|
| +};
|
| +},
|
| +_scopeKeyframes: function (rule, scopeId) {
|
| +rule.keyframesNameRx = new RegExp(rule.keyframesName, 'g');
|
| +rule.transformedKeyframesName = rule.keyframesName + '-' + scopeId;
|
| +rule.transformedSelector = rule.transformedSelector || rule.selector;
|
| +rule.selector = rule.transformedSelector.replace(rule.keyframesName, rule.transformedKeyframesName);
|
| +},
|
| _scopeSelector: function (rule, hostRx, hostSelector, viaAttr, scopeId) {
|
| rule.transformedSelector = rule.transformedSelector || rule.selector;
|
| var selector = rule.transformedSelector;
|
| var scope = viaAttr ? '[' + styleTransformer.SCOPE_NAME + '~=' + scopeId + ']' : '.' + scopeId;
|
| var parts = selector.split(',');
|
| for (var i = 0, l = parts.length, p; i < l && (p = parts[i]); i++) {
|
| -parts[i] = p.match(hostRx) ? p.replace(hostSelector, hostSelector + scope) : scope + ' ' + p;
|
| +parts[i] = p.match(hostRx) ? p.replace(hostSelector, scope) : scope + ' ' + p;
|
| }
|
| rule.selector = parts.join(',');
|
| },
|
| @@ -3107,8 +3225,9 @@ props[i] = v;
|
| rx: {
|
| VAR_ASSIGN: /(?:^|[;\s{]\s*)(--[\w-]*?)\s*:\s*(?:([^;{]*)|{([^}]*)})(?:(?=[;\s}])|$)/gi,
|
| MIXIN_MATCH: /(?:^|\W+)@apply[\s]*\(([^)]*)\)/i,
|
| -VAR_MATCH: /(^|\W+)var\([\s]*([^,)]*)[\s]*,?[\s]*((?:[^,)]*)|(?:[^;]*\([^;)]*\)))[\s]*?\)/gi,
|
| +VAR_MATCH: /(^|\W+)var\([\s]*([^,)]*)[\s]*,?[\s]*((?:[^,()]*)|(?:[^;()]*\([^;)]*\)))[\s]*?\)/gi,
|
| VAR_CAPTURE: /\([\s]*(--[^,\s)]*)(?:,[\s]*(--[^,\s)]*))?(?:\)|,)/gi,
|
| +ANIMATION_MATCH: /(animation\s*:)|(animation-name\s*:)/,
|
| IS_VAR: /^--/,
|
| BRACKETED: /\{[^}]*\}/g,
|
| HOST_PREFIX: '(?:^|[^.#[:])',
|
| @@ -3173,7 +3292,6 @@ return this._objectsEqual(target, source) && this._objectsEqual(source, target);
|
| }());
|
| Polymer.StyleDefaults = function () {
|
| var styleProperties = Polymer.StyleProperties;
|
| -var styleUtil = Polymer.StyleUtil;
|
| var StyleCache = Polymer.StyleCache;
|
| var api = {
|
| _styles: [],
|
| @@ -3219,12 +3337,11 @@ return api;
|
| var serializeValueToAttribute = Polymer.Base.serializeValueToAttribute;
|
| var propertyUtils = Polymer.StyleProperties;
|
| var styleTransformer = Polymer.StyleTransformer;
|
| -var styleUtil = Polymer.StyleUtil;
|
| var styleDefaults = Polymer.StyleDefaults;
|
| var nativeShadow = Polymer.Settings.useNativeShadow;
|
| Polymer.Base._addFeature({
|
| _prepStyleProperties: function () {
|
| -this._ownStylePropertyNames = this._styles ? propertyUtils.decorateStyles(this._styles) : null;
|
| +this._ownStylePropertyNames = this._styles && this._styles.length ? propertyUtils.decorateStyles(this._styles) : null;
|
| },
|
| customStyle: null,
|
| getComputedStyleValue: function (property) {
|
| @@ -3336,7 +3453,7 @@ serializeValueToAttribute.call(this, value, attribute, node);
|
| },
|
| _scopeElementClass: function (element, selector) {
|
| if (!nativeShadow && !this._scopeCssViaAttr) {
|
| -selector += (selector ? ' ' : '') + SCOPE_NAME + ' ' + this.is + (element._scopeSelector ? ' ' + XSCOPE_NAME + ' ' + element._scopeSelector : '');
|
| +selector = (selector ? selector + ' ' : '') + SCOPE_NAME + ' ' + this.is + (element._scopeSelector ? ' ' + XSCOPE_NAME + ' ' + element._scopeSelector : '');
|
| }
|
| return selector;
|
| },
|
| @@ -3383,7 +3500,6 @@ this._prepIs();
|
| this._prepConstructor();
|
| this._prepTemplate();
|
| this._prepStyles();
|
| -this._prepStyleProperties();
|
| this._prepAnnotations();
|
| this._prepEffects();
|
| this._prepBehaviors();
|
| @@ -3423,7 +3539,6 @@ this._listenListeners(b.listeners);
|
| }
|
| });
|
| (function () {
|
| -var nativeShadow = Polymer.Settings.useNativeShadow;
|
| var propertyUtils = Polymer.StyleProperties;
|
| var styleUtil = Polymer.StyleUtil;
|
| var cssParse = Polymer.CssParse;
|
| @@ -3465,7 +3580,7 @@ if (this.include) {
|
| e.textContent = styleUtil.cssFromModules(this.include, true) + e.textContent;
|
| }
|
| if (e.textContent) {
|
| -styleUtil.forEachStyleRule(styleUtil.rulesForStyle(e), function (rule) {
|
| +styleUtil.forEachRule(styleUtil.rulesForStyle(e), function (rule) {
|
| styleTransformer.documentRule(rule);
|
| });
|
| var self = this;
|
| @@ -3570,7 +3685,7 @@ this.__setPropertyOrig(property, value, fromAbove, node);
|
| _debounceTemplate: function (fn) {
|
| Polymer.dom.addDebouncer(this.debounce('_debounceTemplate', fn));
|
| },
|
| -_flushTemplates: function (debouncerExpired) {
|
| +_flushTemplates: function () {
|
| Polymer.dom.flush();
|
| },
|
| _customPrepEffects: function (archetype) {
|
| @@ -3578,7 +3693,7 @@ var parentProps = archetype._parentProps;
|
| for (var prop in parentProps) {
|
| archetype._addPropertyEffect(prop, 'function', this._createHostPropEffector(prop));
|
| }
|
| -for (var prop in this._instanceProps) {
|
| +for (prop in this._instanceProps) {
|
| archetype._addPropertyEffect(prop, 'function', this._createInstancePropEffector(prop));
|
| }
|
| },
|
| @@ -3663,6 +3778,9 @@ this.dataHost._forwardInstanceProp(this, prop, value);
|
| },
|
| _extendTemplate: function (template, proto) {
|
| var n$ = Object.getOwnPropertyNames(proto);
|
| +if (proto._propertySetter) {
|
| +template._propertySetter = proto._propertySetter;
|
| +}
|
| for (var i = 0, n; i < n$.length && (n = n$[i]); i++) {
|
| var val = template[n];
|
| var pd = Object.getOwnPropertyDescriptor(proto, n);
|
| @@ -3743,9 +3861,11 @@ model = model || {};
|
| if (this._parentProps) {
|
| var templatized = this._templatized;
|
| for (var prop in this._parentProps) {
|
| +if (model[prop] === undefined) {
|
| model[prop] = templatized[this._parentPropPrefix + prop];
|
| }
|
| }
|
| +}
|
| return new this.ctor(model, this);
|
| },
|
| modelForElement: function (el) {
|
| @@ -3876,7 +3996,7 @@ for (var j = 0; j < s.removed.length; j++) {
|
| key = this.getKey(s.removed[j]);
|
| keyMap[key] = keyMap[key] ? null : -1;
|
| }
|
| -for (var j = 0; j < s.addedCount; j++) {
|
| +for (j = 0; j < s.addedCount; j++) {
|
| var item = this.userArray[s.index + j];
|
| key = this.getKey(item);
|
| key = key === undefined ? this.add(item) : key;
|
| @@ -3886,7 +4006,7 @@ s.addedKeys.push(key);
|
| }
|
| var removed = [];
|
| var added = [];
|
| -for (var key in keyMap) {
|
| +for (key in keyMap) {
|
| if (keyMap[key] < 0) {
|
| this.removeKey(key);
|
| removed.push(key);
|
| @@ -4083,7 +4203,6 @@ this._debounceTemplate(this._render);
|
| this._flushTemplates();
|
| },
|
| _render: function () {
|
| -var c = this.collection;
|
| if (this._needFullRefresh) {
|
| this._applyFullRefresh();
|
| this._needFullRefresh = false;
|
| @@ -4144,7 +4263,7 @@ keys.sort(function (a, b) {
|
| return self._sortFn(c.getItem(a), c.getItem(b));
|
| });
|
| }
|
| -for (var i = 0; i < keys.length; i++) {
|
| +for (i = 0; i < keys.length; i++) {
|
| var key = keys[i];
|
| var inst = this._instances[i];
|
| if (inst) {
|
| @@ -4167,21 +4286,21 @@ return a - b;
|
| },
|
| _applySplicesUserSort: function (splices) {
|
| var c = this.collection;
|
| -var instances = this._instances;
|
| var keyMap = {};
|
| +var key;
|
| for (var i = 0, s; i < splices.length && (s = splices[i]); i++) {
|
| for (var j = 0; j < s.removed.length; j++) {
|
| -var key = s.removed[j];
|
| +key = s.removed[j];
|
| keyMap[key] = keyMap[key] ? null : -1;
|
| }
|
| -for (var j = 0; j < s.added.length; j++) {
|
| -var key = s.added[j];
|
| +for (j = 0; j < s.added.length; j++) {
|
| +key = s.added[j];
|
| keyMap[key] = keyMap[key] ? null : 1;
|
| }
|
| }
|
| var removedIdxs = [];
|
| var addedKeys = [];
|
| -for (var key in keyMap) {
|
| +for (key in keyMap) {
|
| if (keyMap[key] === -1) {
|
| removedIdxs.push(this._keyToInstIdx[key]);
|
| }
|
| @@ -4191,7 +4310,7 @@ addedKeys.push(key);
|
| }
|
| if (removedIdxs.length) {
|
| removedIdxs.sort(this._numericSort);
|
| -for (var i = removedIdxs.length - 1; i >= 0; i--) {
|
| +for (i = removedIdxs.length - 1; i >= 0; i--) {
|
| var idx = removedIdxs[i];
|
| if (idx !== undefined) {
|
| this._detachAndRemoveInstance(idx);
|
| @@ -4209,7 +4328,7 @@ addedKeys.sort(function (a, b) {
|
| return self._sortFn(c.getItem(a), c.getItem(b));
|
| });
|
| var start = 0;
|
| -for (var i = 0; i < addedKeys.length; i++) {
|
| +for (i = 0; i < addedKeys.length; i++) {
|
| start = this._insertRowUserSort(start, addedKeys[i]);
|
| }
|
| }
|
| @@ -4239,12 +4358,11 @@ this._insertPlaceholder(idx, key);
|
| return idx;
|
| },
|
| _applySplicesArrayOrder: function (splices) {
|
| -var c = this.collection;
|
| for (var i = 0, s; i < splices.length && (s = splices[i]); i++) {
|
| for (var j = 0; j < s.removed.length; j++) {
|
| this._detachAndRemoveInstance(s.index);
|
| }
|
| -for (var j = 0; j < s.addedKeys.length; j++) {
|
| +for (j = 0; j < s.addedKeys.length; j++) {
|
| this._insertPlaceholder(s.index + j, s.addedKeys[j]);
|
| }
|
| }
|
| @@ -4577,8 +4695,14 @@ _template: null,
|
| created: function () {
|
| var self = this;
|
| Polymer.RenderStatus.whenReady(function () {
|
| +if (document.readyState == 'loading') {
|
| +document.addEventListener('DOMContentLoaded', function () {
|
| self._markImportsReady();
|
| });
|
| +} else {
|
| +self._markImportsReady();
|
| +}
|
| +});
|
| },
|
| _ensureReady: function () {
|
| if (!this._readied) {
|
|
|