mirror of
https://github.com/Polymer/polymer.git
synced 2025-02-25 18:55:30 -06:00
Merge branch 'master' into style-fixes
This commit is contained in:
commit
a61028ea49
5
.eslintignore
Normal file
5
.eslintignore
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
node_modules/*
|
||||||
|
bower_components/*
|
||||||
|
test/*
|
||||||
|
src/**/demo/*
|
||||||
|
src/**/experimental/*
|
17
.eslintrc.json
Normal file
17
.eslintrc.json
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"extends": "eslint:recommended",
|
||||||
|
"rules": {
|
||||||
|
"no-console": 0
|
||||||
|
},
|
||||||
|
"env": {
|
||||||
|
"browser": true
|
||||||
|
},
|
||||||
|
"plugins": [
|
||||||
|
"html"
|
||||||
|
],
|
||||||
|
"globals": {
|
||||||
|
"CustomElements": true,
|
||||||
|
"HTMLImports": true,
|
||||||
|
"Polymer": true
|
||||||
|
}
|
||||||
|
}
|
@ -15,6 +15,7 @@ before_script:
|
|||||||
- npm install -g bower
|
- npm install -g bower
|
||||||
- bower install
|
- bower install
|
||||||
script:
|
script:
|
||||||
|
- gulp lint
|
||||||
- xvfb-run wct
|
- xvfb-run wct
|
||||||
- "if [ \"${TRAVIS_PULL_REQUEST}\" = \"false\" ]; then wct -s 'default'; fi"
|
- "if [ \"${TRAVIS_PULL_REQUEST}\" = \"false\" ]; then wct -s 'default'; fi"
|
||||||
env:
|
env:
|
||||||
|
@ -20,6 +20,7 @@ var runseq = require('run-sequence');
|
|||||||
var lazypipe = require('lazypipe');
|
var lazypipe = require('lazypipe');
|
||||||
var polyclean = require('polyclean');
|
var polyclean = require('polyclean');
|
||||||
var del = require('del');
|
var del = require('del');
|
||||||
|
var eslint = require('gulp-eslint');
|
||||||
|
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
|
|
||||||
@ -124,3 +125,10 @@ gulp.task('audit', function() {
|
|||||||
gulp.task('release', function(cb) {
|
gulp.task('release', function(cb) {
|
||||||
runseq('default', ['copy-bower-json', 'audit'], cb);
|
runseq('default', ['copy-bower-json', 'audit'], cb);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
gulp.task('lint', function() {
|
||||||
|
return gulp.src('src/**/*.html')
|
||||||
|
.pipe(eslint())
|
||||||
|
.pipe(eslint.format())
|
||||||
|
.pipe(eslint.failAfterError());
|
||||||
|
});
|
||||||
|
@ -9,8 +9,10 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"del": "^1.1.1",
|
"del": "^1.1.1",
|
||||||
|
"eslint-plugin-html": "^1.3.0",
|
||||||
"gulp": "^3.8.11",
|
"gulp": "^3.8.11",
|
||||||
"gulp-audit": "^1.0.0",
|
"gulp-audit": "^1.0.0",
|
||||||
|
"gulp-eslint": "^1.1.1",
|
||||||
"gulp-rename": "^1.2.2",
|
"gulp-rename": "^1.2.2",
|
||||||
"gulp-replace": "^0.5.3",
|
"gulp-replace": "^0.5.3",
|
||||||
"gulp-vulcanize": "^6.0.1",
|
"gulp-vulcanize": "^6.0.1",
|
||||||
@ -21,7 +23,7 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "gulp",
|
"build": "gulp",
|
||||||
"test": "wct",
|
"test": "gulp lint && wct",
|
||||||
"test-build": "gulp switch && wct && gulp restore"
|
"test-build": "gulp switch && wct && gulp restore"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
|
@ -312,7 +312,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
// bindings (other attributes)
|
// bindings (other attributes)
|
||||||
else if (b = this._parseNodeAttributeAnnotation(node, n, v)) {
|
else if ((b = this._parseNodeAttributeAnnotation(node, n, v))) {
|
||||||
annotation.bindings.push(b);
|
annotation.bindings.push(b);
|
||||||
}
|
}
|
||||||
// static id
|
// static id
|
||||||
|
@ -56,8 +56,8 @@ Polymer.ArraySplice = (function() {
|
|||||||
for (var j = 0; j < columnCount; j++)
|
for (var j = 0; j < columnCount; j++)
|
||||||
distances[0][j] = j;
|
distances[0][j] = j;
|
||||||
|
|
||||||
for (var i = 1; i < rowCount; i++) {
|
for (i = 1; i < rowCount; i++) {
|
||||||
for (var j = 1; j < columnCount; j++) {
|
for (j = 1; j < columnCount; j++) {
|
||||||
if (this.equals(current[currentStart + j - 1], old[oldStart + i - 1]))
|
if (this.equals(current[currentStart + j - 1], old[oldStart + i - 1]))
|
||||||
distances[i][j] = distances[i - 1][j - 1];
|
distances[i][j] = distances[i - 1][j - 1];
|
||||||
else {
|
else {
|
||||||
@ -181,7 +181,7 @@ Polymer.ArraySplice = (function() {
|
|||||||
this.calcEditDistances(current, currentStart, currentEnd,
|
this.calcEditDistances(current, currentStart, currentEnd,
|
||||||
old, oldStart, oldEnd));
|
old, oldStart, oldEnd));
|
||||||
|
|
||||||
var splice = undefined;
|
splice = undefined;
|
||||||
var splices = [];
|
var splices = [];
|
||||||
var index = currentStart;
|
var index = currentStart;
|
||||||
var oldIndex = oldStart;
|
var oldIndex = oldStart;
|
||||||
|
@ -256,7 +256,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
//if (node._prepParentProperties || !node._propertyInfo || (p && p.notify)) {
|
//if (node._prepParentProperties || !node._propertyInfo || (p && p.notify)) {
|
||||||
this._addNotifyListener(node, inst, info.event, info.changedFn);
|
this._addNotifyListener(node, inst, info.event, info.changedFn);
|
||||||
//}
|
//}
|
||||||
};
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// TODO(sorvell): note, adding these synchronously may impact performance,
|
// TODO(sorvell): note, adding these synchronously may impact performance,
|
||||||
|
@ -50,7 +50,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
},
|
},
|
||||||
|
|
||||||
removeKey: function(key) {
|
removeKey: function(key) {
|
||||||
if (key = this._parseKey(key)) {
|
if ((key = this._parseKey(key))) {
|
||||||
this._removeFromMap(this.store[key]);
|
this._removeFromMap(this.store[key]);
|
||||||
delete this.store[key];
|
delete this.store[key];
|
||||||
}
|
}
|
||||||
@ -95,7 +95,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
},
|
},
|
||||||
|
|
||||||
setItem: function(key, item) {
|
setItem: function(key, item) {
|
||||||
if (key = this._parseKey(key)) {
|
if ((key = this._parseKey(key))) {
|
||||||
var old = this.store[key];
|
var old = this.store[key];
|
||||||
if (old) {
|
if (old) {
|
||||||
this._removeFromMap(old);
|
this._removeFromMap(old);
|
||||||
@ -110,7 +110,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
},
|
},
|
||||||
|
|
||||||
getItem: function(key) {
|
getItem: function(key) {
|
||||||
if (key = this._parseKey(key)) {
|
if ((key = this._parseKey(key))) {
|
||||||
return this.store[key];
|
return this.store[key];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -140,7 +140,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
key = this.getKey(s.removed[j]);
|
key = this.getKey(s.removed[j]);
|
||||||
keyMap[key] = keyMap[key] ? null : -1;
|
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];
|
var item = this.userArray[s.index + j];
|
||||||
key = this.getKey(item);
|
key = this.getKey(item);
|
||||||
key = (key === undefined) ? this.add(item) : key;
|
key = (key === undefined) ? this.add(item) : key;
|
||||||
@ -154,7 +154,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
// Convert added/removed key map to added/removed arrays
|
// Convert added/removed key map to added/removed arrays
|
||||||
var removed = [];
|
var removed = [];
|
||||||
var added = [];
|
var added = [];
|
||||||
for (var key in keyMap) {
|
for (key in keyMap) {
|
||||||
if (keyMap[key] < 0) {
|
if (keyMap[key] < 0) {
|
||||||
this.removeKey(key);
|
this.removeKey(key);
|
||||||
removed.push(key);
|
removed.push(key);
|
||||||
|
@ -71,7 +71,6 @@ Note, all features of `custom-style` are available when defining styles as part
|
|||||||
<script>
|
<script>
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
var nativeShadow = Polymer.Settings.useNativeShadow;
|
|
||||||
var propertyUtils = Polymer.StyleProperties;
|
var propertyUtils = Polymer.StyleProperties;
|
||||||
var styleUtil = Polymer.StyleUtil;
|
var styleUtil = Polymer.StyleUtil;
|
||||||
var cssParse = Polymer.CssParse;
|
var cssParse = Polymer.CssParse;
|
||||||
|
@ -14,7 +14,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
|
|
||||||
var DomApi = Polymer.DomApi.ctor;
|
var DomApi = Polymer.DomApi.ctor;
|
||||||
var Settings = Polymer.Settings;
|
var Settings = Polymer.Settings;
|
||||||
var hasDomApi = Polymer.DomApi.hasDomApi;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DomApi.EffectiveNodesObserver tracks changes to an element's
|
* DomApi.EffectiveNodesObserver tracks changes to an element's
|
||||||
@ -82,7 +81,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_notify: function(mxns) {
|
_notify: function() {
|
||||||
this._beforeCallListeners();
|
this._beforeCallListeners();
|
||||||
this._callListeners();
|
this._callListeners();
|
||||||
},
|
},
|
||||||
@ -164,8 +163,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// process adds
|
// process adds
|
||||||
for (var i=0, s; (i<splices.length) && (s=splices[i]); i++) {
|
for (i=0, s; (i<splices.length) && (s=splices[i]); i++) {
|
||||||
for (var j=s.index; j < s.index + s.addedCount; j++) {
|
for (j=s.index; j < s.index + s.addedCount; j++) {
|
||||||
info.addedNodes.push(newNodes[j]);
|
info.addedNodes.push(newNodes[j]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -189,9 +188,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
var baseSetup = DomApi.EffectiveNodesObserver.prototype._setup;
|
var baseSetup = DomApi.EffectiveNodesObserver.prototype._setup;
|
||||||
var baseCleanup = DomApi.EffectiveNodesObserver.prototype._cleanup;
|
var baseCleanup = DomApi.EffectiveNodesObserver.prototype._cleanup;
|
||||||
|
|
||||||
var beforeCallListeners = DomApi.EffectiveNodesObserver
|
|
||||||
.prototype._beforeCallListeners;
|
|
||||||
|
|
||||||
Polymer.Base.extend(DomApi.EffectiveNodesObserver.prototype, {
|
Polymer.Base.extend(DomApi.EffectiveNodesObserver.prototype, {
|
||||||
|
|
||||||
_setup: function() {
|
_setup: function() {
|
||||||
|
@ -587,7 +587,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
return this.node.textContent;
|
return this.node.textContent;
|
||||||
} else {
|
} else {
|
||||||
var tc = [];
|
var tc = [];
|
||||||
for (var i = 0, cn = this.childNodes, c; c = cn[i]; i++) {
|
for (var i = 0, cn = this.childNodes, c; (c = cn[i]); i++) {
|
||||||
if (c.nodeType !== Node.COMMENT_NODE) {
|
if (c.nodeType !== Node.COMMENT_NODE) {
|
||||||
tc.push(c.textContent);
|
tc.push(c.textContent);
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ Polymer.domInnerHTML = (function() {
|
|||||||
var tagName = node.localName;
|
var tagName = node.localName;
|
||||||
var s = '<' + tagName;
|
var s = '<' + tagName;
|
||||||
var attrs = node.attributes;
|
var attrs = node.attributes;
|
||||||
for (var i = 0, attr; attr = attrs[i]; i++) {
|
for (var i = 0, attr; (attr = attrs[i]); i++) {
|
||||||
s += ' ' + attr.name + '="' + escapeAttr(attr.value) + '"';
|
s += ' ' + attr.name + '="' + escapeAttr(attr.value) + '"';
|
||||||
}
|
}
|
||||||
s += '>';
|
s += '>';
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
* @param {String} id The id at which to register the dom-module.
|
* @param {String} id The id at which to register the dom-module.
|
||||||
*/
|
*/
|
||||||
register: function(id) {
|
register: function(id) {
|
||||||
var id = id || this.id ||
|
id = id || this.id ||
|
||||||
this.getAttribute('name') || this.getAttribute('is');
|
this.getAttribute('name') || this.getAttribute('is');
|
||||||
if (id) {
|
if (id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
@ -23,7 +23,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
* TreeApi is a dom manipulation library used by Shady/Polymer.dom to
|
* TreeApi is a dom manipulation library used by Shady/Polymer.dom to
|
||||||
* manipulate composed and logical trees.
|
* manipulate composed and logical trees.
|
||||||
*/
|
*/
|
||||||
var TreeApi = Polymer.TreeApi = {
|
Polymer.TreeApi = {
|
||||||
|
|
||||||
// sad but faster than slice...
|
// sad but faster than slice...
|
||||||
arrayCopyChildNodes: function(parent) {
|
arrayCopyChildNodes: function(parent) {
|
||||||
|
@ -85,7 +85,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
for (var i=0, h; i < callbacks.length; i++) {
|
for (var i=0, h; i < callbacks.length; i++) {
|
||||||
h = callbacks[i];
|
h = callbacks[i];
|
||||||
h[1].apply(h[0], h[2] || Polymer.nar);
|
h[1].apply(h[0], h[2] || Polymer.nar);
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -14,7 +14,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
Polymer.StyleDefaults = (function() {
|
Polymer.StyleDefaults = (function() {
|
||||||
|
|
||||||
var styleProperties = Polymer.StyleProperties;
|
var styleProperties = Polymer.StyleProperties;
|
||||||
var styleUtil = Polymer.StyleUtil;
|
|
||||||
var StyleCache = Polymer.StyleCache;
|
var StyleCache = Polymer.StyleCache;
|
||||||
|
|
||||||
var api = {
|
var api = {
|
||||||
|
@ -25,10 +25,10 @@ Polymer.StyleExtends = (function() {
|
|||||||
var rules = styleUtil.rulesForStyle(style);
|
var rules = styleUtil.rulesForStyle(style);
|
||||||
var self = this;
|
var self = this;
|
||||||
styleUtil.forEachRule(rules, function(rule) {
|
styleUtil.forEachRule(rules, function(rule) {
|
||||||
var map = self._mapRule(rule);
|
self._mapRuleOntoParent(rule);
|
||||||
if (rule.parent) {
|
if (rule.parent) {
|
||||||
var m;
|
var m;
|
||||||
while (m = self.rx.EXTEND.exec(rule.cssText)) {
|
while ((m = self.rx.EXTEND.exec(rule.cssText))) {
|
||||||
var extend = m[1];
|
var extend = m[1];
|
||||||
var extendor = self._findExtendor(extend, rule);
|
var extendor = self._findExtendor(extend, rule);
|
||||||
if (extendor) {
|
if (extendor) {
|
||||||
@ -46,7 +46,7 @@ Polymer.StyleExtends = (function() {
|
|||||||
}, true);
|
}, true);
|
||||||
},
|
},
|
||||||
|
|
||||||
_mapRule: function(rule) {
|
_mapRuleOntoParent: function(rule) {
|
||||||
if (rule.parent) {
|
if (rule.parent) {
|
||||||
var map = rule.parent.map || (rule.parent.map = {});
|
var map = rule.parent.map || (rule.parent.map = {});
|
||||||
var parts = rule.selector.split(',');
|
var parts = rule.selector.split(',');
|
||||||
|
@ -71,7 +71,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
var m, rx = this.rx.VAR_ASSIGN;
|
var m, rx = this.rx.VAR_ASSIGN;
|
||||||
var cssText = rule.parsedCssText;
|
var cssText = rule.parsedCssText;
|
||||||
var any;
|
var any;
|
||||||
while (m = rx.exec(cssText)) {
|
while ((m = rx.exec(cssText))) {
|
||||||
// note: group 2 is var, 3 is mixin
|
// note: group 2 is var, 3 is mixin
|
||||||
properties[m[1]] = (m[2] || m[3]).trim();
|
properties[m[1]] = (m[2] || m[3]).trim();
|
||||||
any = true;
|
any = true;
|
||||||
@ -93,7 +93,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
|
|
||||||
collectPropertiesInCssText: function(cssText, props) {
|
collectPropertiesInCssText: function(cssText, props) {
|
||||||
var m;
|
var m;
|
||||||
while (m = this.rx.VAR_CAPTURE.exec(cssText)) {
|
while ((m = this.rx.VAR_CAPTURE.exec(cssText))) {
|
||||||
props[m[1]] = true;
|
props[m[1]] = true;
|
||||||
var def = m[2];
|
var def = m[2];
|
||||||
if (def && def.match(this.rx.IS_VAR)) {
|
if (def && def.match(this.rx.IS_VAR)) {
|
||||||
@ -145,7 +145,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
valueForProperties: function(property, props) {
|
valueForProperties: function(property, props) {
|
||||||
var parts = property.split(';');
|
var parts = property.split(';');
|
||||||
for (var i=0, p, m; i<parts.length; i++) {
|
for (var i=0, p, m; i<parts.length; i++) {
|
||||||
if (p = parts[i]) {
|
if ((p = parts[i])) {
|
||||||
m = p.match(this.rx.MIXIN_MATCH);
|
m = p.match(this.rx.MIXIN_MATCH);
|
||||||
if (m) {
|
if (m) {
|
||||||
p = this.valueForProperty(props[m[1]], props);
|
p = this.valueForProperty(props[m[1]], props);
|
||||||
|
@ -409,7 +409,6 @@ Then the `observe` property should be configured as follows:
|
|||||||
},
|
},
|
||||||
|
|
||||||
_render: function() {
|
_render: function() {
|
||||||
var c = this.collection;
|
|
||||||
// Choose rendering path: full vs. incremental using splices
|
// Choose rendering path: full vs. incremental using splices
|
||||||
if (this._needFullRefresh) {
|
if (this._needFullRefresh) {
|
||||||
// Full refresh when items, sort, or filter change, or when render() called
|
// Full refresh when items, sort, or filter change, or when render() called
|
||||||
@ -499,7 +498,7 @@ Then the `observe` property should be configured as follows:
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
// Generate instances and assign items and keys
|
// Generate instances and assign items and keys
|
||||||
for (var i=0; i<keys.length; i++) {
|
for (i=0; i<keys.length; i++) {
|
||||||
var key = keys[i];
|
var key = keys[i];
|
||||||
var inst = this._instances[i];
|
var inst = this._instances[i];
|
||||||
if (inst) {
|
if (inst) {
|
||||||
@ -529,23 +528,23 @@ Then the `observe` property should be configured as follows:
|
|||||||
// first, and added rows are insertion-sorted into place using user sort
|
// first, and added rows are insertion-sorted into place using user sort
|
||||||
_applySplicesUserSort: function(splices) {
|
_applySplicesUserSort: function(splices) {
|
||||||
var c = this.collection;
|
var c = this.collection;
|
||||||
var instances = this._instances;
|
|
||||||
var keyMap = {};
|
var keyMap = {};
|
||||||
|
var key;
|
||||||
// Dedupe added and removed keys to a final added/removed map
|
// Dedupe added and removed keys to a final added/removed map
|
||||||
for (var i=0, s; (i<splices.length) && (s=splices[i]); i++) {
|
for (var i=0, s; (i<splices.length) && (s=splices[i]); i++) {
|
||||||
for (var j=0; j<s.removed.length; j++) {
|
for (var j=0; j<s.removed.length; j++) {
|
||||||
var key = s.removed[j];
|
key = s.removed[j];
|
||||||
keyMap[key] = keyMap[key] ? null : -1;
|
keyMap[key] = keyMap[key] ? null : -1;
|
||||||
}
|
}
|
||||||
for (var j=0; j<s.added.length; j++) {
|
for (j=0; j<s.added.length; j++) {
|
||||||
var key = s.added[j];
|
key = s.added[j];
|
||||||
keyMap[key] = keyMap[key] ? null : 1;
|
keyMap[key] = keyMap[key] ? null : 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Convert added/removed key map to added/removed arrays
|
// Convert added/removed key map to added/removed arrays
|
||||||
var removedIdxs = [];
|
var removedIdxs = [];
|
||||||
var addedKeys = [];
|
var addedKeys = [];
|
||||||
for (var key in keyMap) {
|
for (key in keyMap) {
|
||||||
if (keyMap[key] === -1) {
|
if (keyMap[key] === -1) {
|
||||||
removedIdxs.push(this._keyToInstIdx[key]);
|
removedIdxs.push(this._keyToInstIdx[key]);
|
||||||
}
|
}
|
||||||
@ -559,7 +558,7 @@ Then the `observe` property should be configured as follows:
|
|||||||
// so we don't invalidate instance index
|
// so we don't invalidate instance index
|
||||||
// use numeric sort, default .sort is alphabetic
|
// use numeric sort, default .sort is alphabetic
|
||||||
removedIdxs.sort(this._numericSort);
|
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];
|
var idx = removedIdxs[i];
|
||||||
// Removed idx may be undefined if item was previously filtered out
|
// Removed idx may be undefined if item was previously filtered out
|
||||||
if (idx !== undefined) {
|
if (idx !== undefined) {
|
||||||
@ -583,7 +582,7 @@ Then the `observe` property should be configured as follows:
|
|||||||
});
|
});
|
||||||
// Insertion-sort new instances into place (from pool or newly created)
|
// Insertion-sort new instances into place (from pool or newly created)
|
||||||
var start = 0;
|
var start = 0;
|
||||||
for (var i=0; i<addedKeys.length; i++) {
|
for (i=0; i<addedKeys.length; i++) {
|
||||||
start = this._insertRowUserSort(start, addedKeys[i]);
|
start = this._insertRowUserSort(start, addedKeys[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -622,13 +621,12 @@ Then the `observe` property should be configured as follows:
|
|||||||
// rows are as placeholders, and placeholders are updated to
|
// rows are as placeholders, and placeholders are updated to
|
||||||
// actual rows at the end to take full advantage of removed rows
|
// actual rows at the end to take full advantage of removed rows
|
||||||
_applySplicesArrayOrder: function(splices) {
|
_applySplicesArrayOrder: function(splices) {
|
||||||
var c = this.collection;
|
|
||||||
for (var i=0, s; (i<splices.length) && (s=splices[i]); i++) {
|
for (var i=0, s; (i<splices.length) && (s=splices[i]); i++) {
|
||||||
// Detach & pool removed instances
|
// Detach & pool removed instances
|
||||||
for (var j=0; j<s.removed.length; j++) {
|
for (var j=0; j<s.removed.length; j++) {
|
||||||
this._detachAndRemoveInstance(s.index);
|
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]);
|
this._insertPlaceholder(s.index+j, s.addedKeys[j]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -181,7 +181,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
Polymer.dom.addDebouncer(this.debounce('_debounceTemplate', fn));
|
Polymer.dom.addDebouncer(this.debounce('_debounceTemplate', fn));
|
||||||
},
|
},
|
||||||
|
|
||||||
_flushTemplates: function(debouncerExpired) {
|
_flushTemplates: function() {
|
||||||
Polymer.dom.flush();
|
Polymer.dom.flush();
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -191,7 +191,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
archetype._addPropertyEffect(prop, 'function',
|
archetype._addPropertyEffect(prop, 'function',
|
||||||
this._createHostPropEffector(prop));
|
this._createHostPropEffector(prop));
|
||||||
}
|
}
|
||||||
for (var prop in this._instanceProps) {
|
for (prop in this._instanceProps) {
|
||||||
archetype._addPropertyEffect(prop, 'function',
|
archetype._addPropertyEffect(prop, 'function',
|
||||||
this._createInstancePropEffector(prop));
|
this._createInstancePropEffector(prop));
|
||||||
}
|
}
|
||||||
@ -309,12 +309,14 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Extension points for Templatizer sub-classes
|
// Extension points for Templatizer sub-classes
|
||||||
|
/* eslint-disable no-unused-vars */
|
||||||
_showHideChildren: function(hidden) { },
|
_showHideChildren: function(hidden) { },
|
||||||
_forwardInstancePath: function(inst, path, value) { },
|
_forwardInstancePath: function(inst, path, value) { },
|
||||||
_forwardInstanceProp: function(inst, prop, value) { },
|
_forwardInstanceProp: function(inst, prop, value) { },
|
||||||
// Defined-check rather than thunk used to avoid unnecessary work for these:
|
// Defined-check rather than thunk used to avoid unnecessary work for these:
|
||||||
// _forwardParentPath: function(path, value) { },
|
// _forwardParentPath: function(path, value) { },
|
||||||
// _forwardParentProp: function(prop, value) { },
|
// _forwardParentProp: function(prop, value) { },
|
||||||
|
/* eslint-enable no-unused-vars */
|
||||||
|
|
||||||
_notifyPathUpImpl: function(path, value) {
|
_notifyPathUpImpl: function(path, value) {
|
||||||
var dataHost = this.dataHost;
|
var dataHost = this.dataHost;
|
||||||
@ -448,7 +450,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
// An element with a _templateInstance marks the top boundary
|
// An element with a _templateInstance marks the top boundary
|
||||||
// of a scope; walk up until we find one, and then ensure that
|
// of a scope; walk up until we find one, and then ensure that
|
||||||
// its dataHost matches `this`, meaning this dom-repeat stamped it
|
// its dataHost matches `this`, meaning this dom-repeat stamped it
|
||||||
if (model = el._templateInstance) {
|
if ((model = el._templateInstance)) {
|
||||||
// Found an element stamped by another template; keep walking up
|
// Found an element stamped by another template; keep walking up
|
||||||
// from its dataHost
|
// from its dataHost
|
||||||
if (model.dataHost != this) {
|
if (model.dataHost != this) {
|
||||||
|
@ -108,7 +108,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
_setAttributeToProperty: function(model, attribute, property, info) {
|
_setAttributeToProperty: function(model, attribute, property, info) {
|
||||||
// Don't deserialize back to property if currently reflecting
|
// Don't deserialize back to property if currently reflecting
|
||||||
if (!this._serializing) {
|
if (!this._serializing) {
|
||||||
var property = property || Polymer.CaseMap.dashToCamelCase(attribute);
|
property = (property || Polymer.CaseMap.dashToCamelCase(attribute));
|
||||||
// fallback to property lookup
|
// fallback to property lookup
|
||||||
// TODO(sorvell): check for _propertyInfo existence because of dom-bind
|
// TODO(sorvell): check for _propertyInfo existence because of dom-bind
|
||||||
info = info || (this._propertyInfo && this._propertyInfo[property]);
|
info = info || (this._propertyInfo && this._propertyInfo[property]);
|
||||||
@ -236,6 +236,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
* @return {string} String serialized from the provided property value.
|
* @return {string} String serialized from the provided property value.
|
||||||
*/
|
*/
|
||||||
serialize: function(value) {
|
serialize: function(value) {
|
||||||
|
/* eslint-disable no-fallthrough */
|
||||||
switch (typeof value) {
|
switch (typeof value) {
|
||||||
case 'boolean':
|
case 'boolean':
|
||||||
return value ? '' : undefined;
|
return value ? '' : undefined;
|
||||||
@ -255,7 +256,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
return value != null ? value : undefined;
|
return value != null ? value : undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* eslint-enable no-fallthrough */
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -116,7 +116,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
if (info) {
|
if (info) {
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
return info || Polymer.nob;
|
return info || Polymer.nob;
|
||||||
},
|
},
|
||||||
@ -138,7 +138,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
// union properties, behaviors.properties, and propertyEffects
|
// union properties, behaviors.properties, and propertyEffects
|
||||||
_prepPropertyInfo: function() {
|
_prepPropertyInfo: function() {
|
||||||
this._propertyInfo = {};
|
this._propertyInfo = {};
|
||||||
for (var i=0, p; i < this.behaviors.length; i++) {
|
for (var i=0; i < this.behaviors.length; i++) {
|
||||||
this._addPropertyInfo(this._propertyInfo, this.behaviors[i].properties);
|
this._addPropertyInfo(this._propertyInfo, this.behaviors[i].properties);
|
||||||
}
|
}
|
||||||
this._addPropertyInfo(this._propertyInfo, this.properties);
|
this._addPropertyInfo(this._propertyInfo, this.properties);
|
||||||
@ -174,7 +174,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -342,9 +342,9 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
d -= s.addedCount;
|
d -= s.addedCount;
|
||||||
}
|
}
|
||||||
// process adds
|
// process adds
|
||||||
for (var i=0, s, next; (i<splices.length) && (s=splices[i]); i++) {
|
for (var i=0, s, next; (i<splices.length) && (s=splices[i]); i++) { //eslint-disable-line no-redeclare
|
||||||
next = composed[s.index];
|
next = composed[s.index];
|
||||||
for (var j=s.index, n; j < s.index + s.addedCount; j++) {
|
for (j=s.index, n; j < s.index + s.addedCount; j++) {
|
||||||
n = children[j];
|
n = children[j];
|
||||||
TreeApi.Composed.insertBefore(container, n, next);
|
TreeApi.Composed.insertBefore(container, n, next);
|
||||||
// TODO(sorvell): is this splice strictly needed?
|
// TODO(sorvell): is this splice strictly needed?
|
||||||
|
@ -227,7 +227,7 @@ TODO(sjmiles): this module should produce either syntactic metadata
|
|||||||
},
|
},
|
||||||
|
|
||||||
// push configuration references at configure time
|
// push configuration references at configure time
|
||||||
_configureAnnotationReferences: function(config) {
|
_configureAnnotationReferences: function() {
|
||||||
var notes = this._notes;
|
var notes = this._notes;
|
||||||
var nodes = this._nodes;
|
var nodes = this._nodes;
|
||||||
for (var i=0; i<notes.length; i++) {
|
for (var i=0; i<notes.length; i++) {
|
||||||
|
@ -255,7 +255,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// enforce gesture recognizer order
|
// enforce gesture recognizer order
|
||||||
for (var i = 0, r; i < recognizers.length; i++) {
|
for (i = 0, r; i < recognizers.length; i++) {
|
||||||
r = recognizers[i];
|
r = recognizers[i];
|
||||||
if (gs[r.name] && !handled[r.name]) {
|
if (gs[r.name] && !handled[r.name]) {
|
||||||
handled[r.name] = true;
|
handled[r.name] = true;
|
||||||
|
@ -183,18 +183,19 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
// item in collection associated with key for that item
|
// item in collection associated with key for that item
|
||||||
if (array) {
|
if (array) {
|
||||||
var coll = Polymer.Collection.get(array);
|
var coll = Polymer.Collection.get(array);
|
||||||
|
var old, key;
|
||||||
if (last[0] == '#') {
|
if (last[0] == '#') {
|
||||||
// Part was key; lookup item in collection
|
// Part was key; lookup item in collection
|
||||||
var key = last;
|
key = last;
|
||||||
var old = coll.getItem(key);
|
old = coll.getItem(key);
|
||||||
// Update last part from key to index: O(n) lookup unavoidable
|
// Update last part from key to index: O(n) lookup unavoidable
|
||||||
last = array.indexOf(old);
|
last = array.indexOf(old);
|
||||||
// Replace item associated with key in collection
|
// Replace item associated with key in collection
|
||||||
coll.setItem(key, value);
|
coll.setItem(key, value);
|
||||||
} else if (parseInt(last, 10) == last) {
|
} else if (parseInt(last, 10) == last) {
|
||||||
// Dereference index & lookup collection key
|
// Dereference index & lookup collection key
|
||||||
var old = prop[last];
|
old = prop[last];
|
||||||
var key = coll.getKey(old);
|
key = coll.getKey(old);
|
||||||
// Translate array indices to collection keys for path notificaiton
|
// Translate array indices to collection keys for path notificaiton
|
||||||
parts[i] = key;
|
parts[i] = key;
|
||||||
// Replace item associated with key in collection
|
// Replace item associated with key in collection
|
||||||
@ -527,7 +528,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
* @param {...any} var_args Items to insert into array.
|
* @param {...any} var_args Items to insert into array.
|
||||||
* @return {Array} Array of removed items.
|
* @return {Array} Array of removed items.
|
||||||
*/
|
*/
|
||||||
splice: function(path, start, deleteCount) {
|
splice: function(path, start) {
|
||||||
var info = {};
|
var info = {};
|
||||||
var array = this._get(path, this, info);
|
var array = this._get(path, this, info);
|
||||||
// Normalize fancy native splice handling of crazy start values
|
// Normalize fancy native splice handling of crazy start values
|
||||||
|
@ -144,7 +144,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
getEffectiveTextContent: function() {
|
getEffectiveTextContent: function() {
|
||||||
var cn = this.getEffectiveChildNodes();
|
var cn = this.getEffectiveChildNodes();
|
||||||
var tc = [];
|
var tc = [];
|
||||||
for (var i=0, c; c = cn[i]; i++) {
|
for (var i=0, c; (c = cn[i]); i++) {
|
||||||
if (c.nodeType !== Node.COMMENT_NODE) {
|
if (c.nodeType !== Node.COMMENT_NODE) {
|
||||||
tc.push(Polymer.dom(c).textContent);
|
tc.push(Polymer.dom(c).textContent);
|
||||||
}
|
}
|
||||||
@ -215,7 +215,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
fire: function(type, detail, options) {
|
fire: function(type, detail, options) {
|
||||||
options = options || Polymer.nob;
|
options = options || Polymer.nob;
|
||||||
var node = options.node || this;
|
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 bubbles = options.bubbles === undefined ? true : options.bubbles;
|
||||||
var cancelable = Boolean(options.cancelable);
|
var cancelable = Boolean(options.cancelable);
|
||||||
var useCache = options._useCache;
|
var useCache = options._useCache;
|
||||||
|
@ -19,7 +19,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
|
|
||||||
var propertyUtils = Polymer.StyleProperties;
|
var propertyUtils = Polymer.StyleProperties;
|
||||||
var styleTransformer = Polymer.StyleTransformer;
|
var styleTransformer = Polymer.StyleTransformer;
|
||||||
var styleUtil = Polymer.StyleUtil;
|
|
||||||
var styleDefaults = Polymer.StyleDefaults;
|
var styleDefaults = Polymer.StyleDefaults;
|
||||||
|
|
||||||
var nativeShadow = Polymer.Settings.useNativeShadow;
|
var nativeShadow = Polymer.Settings.useNativeShadow;
|
||||||
@ -93,7 +92,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||||||
|
|
||||||
_findStyleHost: function() {
|
_findStyleHost: function() {
|
||||||
var e = this, root;
|
var e = this, root;
|
||||||
while (root = Polymer.dom(e).getOwnerRoot()) {
|
while ((root = Polymer.dom(e).getOwnerRoot())) {
|
||||||
if (Polymer.isInstance(root.host)) {
|
if (Polymer.isInstance(root.host)) {
|
||||||
return root.host;
|
return root.host;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user