update polymer
This commit is contained in:
parent
2a830d2a3d
commit
6f8396a6e7
8 changed files with 106 additions and 57 deletions
|
@ -34,14 +34,14 @@
|
|||
"web-component-tester": "*",
|
||||
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
|
||||
},
|
||||
"homepage": "https://github.com/PolymerElements/iron-overlay-behavior",
|
||||
"homepage": "https://github.com/polymerelements/iron-overlay-behavior",
|
||||
"_release": "1.0.6",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v1.0.6",
|
||||
"commit": "9c77f077f4181b6f03cc986d0f3c224094edbc2d"
|
||||
},
|
||||
"_source": "git://github.com/PolymerElements/iron-overlay-behavior.git",
|
||||
"_source": "git://github.com/polymerelements/iron-overlay-behavior.git",
|
||||
"_target": "^1.0.0",
|
||||
"_originalSource": "PolymerElements/iron-overlay-behavior"
|
||||
"_originalSource": "polymerelements/iron-overlay-behavior"
|
||||
}
|
|
@ -54,7 +54,7 @@
|
|||
"tag": "v1.0.6",
|
||||
"commit": "ec51bf68f05c40373536cc726ca674e4549b7db2"
|
||||
},
|
||||
"_source": "git://github.com/PolymerElements/neon-animation.git",
|
||||
"_source": "git://github.com/polymerelements/neon-animation.git",
|
||||
"_target": "^1.0.0",
|
||||
"_originalSource": "PolymerElements/neon-animation"
|
||||
"_originalSource": "polymerelements/neon-animation"
|
||||
}
|
|
@ -42,7 +42,7 @@
|
|||
"tag": "v1.0.3",
|
||||
"commit": "90b54de14264c19693601b9fc16af6b68a9d48e4"
|
||||
},
|
||||
"_source": "git://github.com/polymerelements/paper-behaviors.git",
|
||||
"_source": "git://github.com/PolymerElements/paper-behaviors.git",
|
||||
"_target": "^1.0.0",
|
||||
"_originalSource": "polymerelements/paper-behaviors"
|
||||
"_originalSource": "PolymerElements/paper-behaviors"
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "polymer",
|
||||
"version": "1.1.1",
|
||||
"version": "1.1.2",
|
||||
"main": [
|
||||
"polymer.html"
|
||||
],
|
||||
|
@ -25,11 +25,11 @@
|
|||
},
|
||||
"private": true,
|
||||
"homepage": "https://github.com/Polymer/polymer",
|
||||
"_release": "1.1.1",
|
||||
"_release": "1.1.2",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v1.1.1",
|
||||
"commit": "c0bd5a73b4bd694b7fa5ead01ff558ed542f6bd8"
|
||||
"tag": "v1.1.2",
|
||||
"commit": "9b0a25e347404ac164bc610bbd2ccbc91b6799b2"
|
||||
},
|
||||
"_source": "git://github.com/Polymer/polymer.git",
|
||||
"_target": "^1.0.0",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "polymer",
|
||||
"version": "1.1.1",
|
||||
"version": "1.1.2",
|
||||
"main": [
|
||||
"polymer.html"
|
||||
],
|
||||
|
|
|
@ -20,7 +20,7 @@ addEventListener('DOMContentLoaded', resolve);
|
|||
}
|
||||
}
|
||||
}());
|
||||
Polymer = {
|
||||
window.Polymer = {
|
||||
Settings: function () {
|
||||
var user = window.Polymer || {};
|
||||
location.search.slice(1).split('&').forEach(function (o) {
|
||||
|
@ -48,15 +48,21 @@ useNativeCustomElements: useNativeCustomElements
|
|||
(function () {
|
||||
var userPolymer = window.Polymer;
|
||||
window.Polymer = function (prototype) {
|
||||
var ctor = desugar(prototype);
|
||||
prototype = ctor.prototype;
|
||||
var options = { prototype: prototype };
|
||||
if (prototype.extends) {
|
||||
options.extends = prototype.extends;
|
||||
if (typeof prototype === 'function') {
|
||||
prototype = prototype.prototype;
|
||||
}
|
||||
if (!prototype) {
|
||||
prototype = {};
|
||||
}
|
||||
var factory = desugar(prototype);
|
||||
prototype = factory.prototype;
|
||||
var options = {
|
||||
prototype: prototype,
|
||||
extends: prototype.extends
|
||||
};
|
||||
Polymer.telemetry._registrate(prototype);
|
||||
document.registerElement(prototype.is, options);
|
||||
return ctor;
|
||||
return factory;
|
||||
};
|
||||
var desugar = function (prototype) {
|
||||
var base = Polymer.Base;
|
||||
|
@ -133,6 +139,8 @@ _addFeature: function (feature) {
|
|||
this.extend(this, feature);
|
||||
},
|
||||
registerCallback: function () {
|
||||
this._desugarBehaviors();
|
||||
this._doBehavior('beforeRegister');
|
||||
this._registerFeatures();
|
||||
this._doBehavior('registered');
|
||||
},
|
||||
|
@ -238,6 +246,7 @@ lcModules[id.toLowerCase()] = this;
|
|||
}
|
||||
},
|
||||
import: function (id, selector) {
|
||||
if (id) {
|
||||
var m = findModule(id);
|
||||
if (!m) {
|
||||
forceDocumentUpgrade();
|
||||
|
@ -248,6 +257,7 @@ m = m.querySelector(selector);
|
|||
}
|
||||
return m;
|
||||
}
|
||||
}
|
||||
});
|
||||
var cePolyfill = window.CustomElements && !CustomElements.useNative;
|
||||
document.registerElement('dom-module', DomModule);
|
||||
|
@ -255,8 +265,7 @@ function forceDocumentUpgrade() {
|
|||
if (cePolyfill) {
|
||||
var script = document._currentScript || document.currentScript;
|
||||
var doc = script && script.ownerDocument;
|
||||
if (doc && !doc.__customElementsForceUpgraded) {
|
||||
doc.__customElementsForceUpgraded = true;
|
||||
if (doc) {
|
||||
CustomElements.upgradeAll(doc);
|
||||
}
|
||||
}
|
||||
|
@ -278,11 +287,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 = [];
|
||||
|
@ -297,15 +312,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) {
|
||||
|
@ -329,6 +335,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);
|
||||
|
@ -561,7 +576,7 @@ debouncer.stop();
|
|||
}
|
||||
}
|
||||
});
|
||||
Polymer.version = '1.1.1';
|
||||
Polymer.version = '1.1.2';
|
||||
Polymer.Base._addFeature({
|
||||
_registerFeatures: function () {
|
||||
this._prepIs();
|
||||
|
|
|
@ -580,8 +580,9 @@ return added;
|
|||
},
|
||||
_tryRemoveUndistributedNode: function (node) {
|
||||
if (this.node.shadyRoot) {
|
||||
if (node._composedParent) {
|
||||
nativeRemoveChild.call(node._composedParent, node);
|
||||
var parent = getComposedParent(node);
|
||||
if (parent) {
|
||||
nativeRemoveChild.call(parent, node);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -618,7 +619,7 @@ if (root && hostNeedsDist) {
|
|||
this._updateInsertionPoints(root.host);
|
||||
this._lazyDistribute(root.host);
|
||||
} else if (ensureComposedRemoval) {
|
||||
removeFromComposedParent(node._composedParent, node);
|
||||
removeFromComposedParent(getComposedParent(node), node);
|
||||
}
|
||||
},
|
||||
_removeDistributedChildren: function (root, container) {
|
||||
|
@ -842,7 +843,7 @@ configurable: true
|
|||
},
|
||||
parentNode: {
|
||||
get: function () {
|
||||
return this.node._lightParent || (this.node.__patched ? this.node._composedParent : this.node.parentNode);
|
||||
return this.node._lightParent || getComposedParent(this.node);
|
||||
},
|
||||
configurable: true
|
||||
},
|
||||
|
@ -964,6 +965,18 @@ DomApi.prototype._getComposedInnerHTML = function () {
|
|||
return getInnerHTML(this.node, true);
|
||||
};
|
||||
} else {
|
||||
var forwardMethods = [
|
||||
'cloneNode',
|
||||
'appendChild',
|
||||
'insertBefore',
|
||||
'removeChild',
|
||||
'replaceChild'
|
||||
];
|
||||
forwardMethods.forEach(function (name) {
|
||||
DomApi.prototype[name] = function () {
|
||||
return this.node[name].apply(this.node, arguments);
|
||||
};
|
||||
});
|
||||
DomApi.prototype.querySelectorAll = function (selector) {
|
||||
return Array.prototype.slice.call(this.node.querySelectorAll(selector));
|
||||
};
|
||||
|
@ -976,9 +989,6 @@ return n;
|
|||
n = n.parentNode;
|
||||
}
|
||||
};
|
||||
DomApi.prototype.cloneNode = function (deep) {
|
||||
return this.node.cloneNode(deep);
|
||||
};
|
||||
DomApi.prototype.importNode = function (externalNode, deep) {
|
||||
var doc = this.node instanceof Document ? this.node : this.node.ownerDocument;
|
||||
return doc.importNode(externalNode, deep);
|
||||
|
@ -1025,7 +1035,7 @@ return this.node.innerHTML = value;
|
|||
configurable: true
|
||||
}
|
||||
});
|
||||
var forwards = [
|
||||
var forwardProperties = [
|
||||
'parentNode',
|
||||
'firstChild',
|
||||
'lastChild',
|
||||
|
@ -1036,7 +1046,7 @@ var forwards = [
|
|||
'nextElementSibling',
|
||||
'previousElementSibling'
|
||||
];
|
||||
forwards.forEach(function (name) {
|
||||
forwardProperties.forEach(function (name) {
|
||||
Object.defineProperty(DomApi.prototype, name, {
|
||||
get: function () {
|
||||
return this.node[name];
|
||||
|
@ -1120,6 +1130,9 @@ node._composedChildren = null;
|
|||
addNodeToComposedChildren(node, parent, children, i);
|
||||
}
|
||||
}
|
||||
function getComposedParent(node) {
|
||||
return node.__patched ? node._composedParent : node.parentNode;
|
||||
}
|
||||
function addNodeToComposedChildren(node, parent, children, i) {
|
||||
node._composedParent = parent;
|
||||
children.splice(i >= 0 ? i : children.length, 0, node);
|
||||
|
@ -1150,6 +1163,7 @@ var p = Element.prototype;
|
|||
var matchesSelector = p.matches || p.matchesSelector || p.mozMatchesSelector || p.msMatchesSelector || p.oMatchesSelector || p.webkitMatchesSelector;
|
||||
return {
|
||||
getLightChildren: getLightChildren,
|
||||
getComposedParent: getComposedParent,
|
||||
getComposedChildren: getComposedChildren,
|
||||
removeFromComposedParent: removeFromComposedParent,
|
||||
saveLightChildrenIfNeeded: saveLightChildrenIfNeeded,
|
||||
|
@ -1338,7 +1352,9 @@ var composed = getComposedChildren(container);
|
|||
var splices = Polymer.ArraySplice.calculateSplices(children, composed);
|
||||
for (var i = 0, d = 0, s; i < splices.length && (s = splices[i]); i++) {
|
||||
for (var j = 0, n; j < s.removed.length && (n = s.removed[j]); j++) {
|
||||
if (getComposedParent(n) === container) {
|
||||
remove(n);
|
||||
}
|
||||
composed.splice(s.index + d, 1);
|
||||
}
|
||||
d -= s.addedCount;
|
||||
|
@ -1351,6 +1367,7 @@ insertBefore(container, n, next);
|
|||
composed.splice(j, 0, n);
|
||||
}
|
||||
}
|
||||
ensureComposedParent(container, children);
|
||||
},
|
||||
_matchesContentSelect: function (node, contentElement) {
|
||||
var select = contentElement.getAttribute('select');
|
||||
|
@ -1380,6 +1397,7 @@ var getLightChildren = Polymer.DomApi.getLightChildren;
|
|||
var matchesSelector = Polymer.DomApi.matchesSelector;
|
||||
var hasInsertionPoint = Polymer.DomApi.hasInsertionPoint;
|
||||
var getComposedChildren = Polymer.DomApi.getComposedChildren;
|
||||
var getComposedParent = Polymer.DomApi.getComposedParent;
|
||||
var removeFromComposedParent = Polymer.DomApi.removeFromComposedParent;
|
||||
function distributeNodeInto(child, insertionPoint) {
|
||||
insertionPoint._distributedNodes.push(child);
|
||||
|
@ -1433,8 +1451,10 @@ node._composedParent = null;
|
|||
nativeRemoveChild.call(parentNode, node);
|
||||
}
|
||||
}
|
||||
function getComposedParent(node) {
|
||||
return node.__patched ? node._composedParent : node.parentNode;
|
||||
function ensureComposedParent(parent, children) {
|
||||
for (var i = 0, n; i < children.length; i++) {
|
||||
children[i]._composedParent = parent;
|
||||
}
|
||||
}
|
||||
function getTopDistributingHost(host) {
|
||||
while (host && hostNeedsRedistribution(host)) {
|
||||
|
|
|
@ -236,7 +236,11 @@ if (!this._template) {
|
|||
this._notes = [];
|
||||
} else {
|
||||
Polymer.Annotations.prepElement = this._prepElement.bind(this);
|
||||
if (this._template._content && this._template._content._notes) {
|
||||
this._notes = this._template._content._notes;
|
||||
} else {
|
||||
this._notes = Polymer.Annotations.parseAnnotations(this._template);
|
||||
}
|
||||
this._processAnnotations(this._notes);
|
||||
Polymer.Annotations.prepElement = null;
|
||||
}
|
||||
|
@ -637,8 +641,7 @@ prevent = dy > dx;
|
|||
prevent = dx > dy;
|
||||
}
|
||||
if (prevent) {
|
||||
//This prevents horizontal scrolling in safari
|
||||
//ev.preventDefault();
|
||||
ev.preventDefault();
|
||||
} else {
|
||||
Gestures.prevent('track');
|
||||
}
|
||||
|
@ -2234,6 +2237,9 @@ clearStyleRules: function (style) {
|
|||
style.__cssRules = null;
|
||||
},
|
||||
forEachStyleRule: function (node, callback) {
|
||||
if (!node) {
|
||||
return;
|
||||
}
|
||||
var s = node.parsedSelector;
|
||||
var skipRules = false;
|
||||
if (node.type === this.ruleTypes.STYLE_RULE) {
|
||||
|
@ -2262,19 +2268,22 @@ afterNode = n$[n$.length - 1];
|
|||
target.insertBefore(style, afterNode && afterNode.nextSibling || target.firstChild);
|
||||
return style;
|
||||
},
|
||||
cssFromModules: function (moduleIds) {
|
||||
cssFromModules: function (moduleIds, warnIfNotFound) {
|
||||
var modules = moduleIds.trim().split(' ');
|
||||
var cssText = '';
|
||||
for (var i = 0; i < modules.length; i++) {
|
||||
cssText += this.cssFromModule(modules[i]);
|
||||
cssText += this.cssFromModule(modules[i], warnIfNotFound);
|
||||
}
|
||||
return cssText;
|
||||
},
|
||||
cssFromModule: function (moduleId) {
|
||||
cssFromModule: function (moduleId, warnIfNotFound) {
|
||||
var m = Polymer.DomModule.import(moduleId);
|
||||
if (m && !m._cssText) {
|
||||
m._cssText = this._cssFromElement(m);
|
||||
}
|
||||
if (!m && warnIfNotFound) {
|
||||
console.warn('Could not find style data in module named', moduleId);
|
||||
}
|
||||
return m && m._cssText || '';
|
||||
},
|
||||
_cssFromElement: function (element) {
|
||||
|
@ -2288,12 +2297,12 @@ cssText += this._cssFromElement(e);
|
|||
} else {
|
||||
if (e.localName === 'style') {
|
||||
var include = e.getAttribute(this.INCLUDE_ATTR);
|
||||
if (include) {
|
||||
cssText += this.cssFromModules(include, true);
|
||||
}
|
||||
e = e.__appliedElement || e;
|
||||
e.parentNode.removeChild(e);
|
||||
cssText += this.resolveCss(e.textContent, element.ownerDocument);
|
||||
if (include) {
|
||||
cssText += this.cssFromModules(include);
|
||||
}
|
||||
} else if (e.import && e.import.body) {
|
||||
cssText += this.resolveCss(e.import.body.textContent, e.import);
|
||||
}
|
||||
|
@ -3230,15 +3239,20 @@ observer.observe(e, { childList: true });
|
|||
_apply: function () {
|
||||
var e = this.__appliedElement || this;
|
||||
if (this.include) {
|
||||
e.textContent += styleUtil.cssFromModules(this.include);
|
||||
e.textContent = styleUtil.cssFromModules(this.include, true) + e.textContent;
|
||||
}
|
||||
var rules = styleUtil.rulesForStyle(e);
|
||||
styleUtil.forEachStyleRule(rules, function (rule) {
|
||||
if (e.textContent) {
|
||||
styleUtil.forEachStyleRule(styleUtil.rulesForStyle(e), function (rule) {
|
||||
styleTransformer.documentRule(rule);
|
||||
});
|
||||
this._applyCustomProperties(e);
|
||||
}
|
||||
},
|
||||
_applyCustomProperties: function (element) {
|
||||
this._computeStyleProperties();
|
||||
var props = this._styleProperties;
|
||||
e.textContent = styleUtil.toCssText(rules, function (rule) {
|
||||
var rules = styleUtil.rulesForStyle(element);
|
||||
element.textContent = styleUtil.toCssText(rules, function (rule) {
|
||||
var css = rule.cssText = rule.parsedCssText;
|
||||
if (rule.propertyInfo && rule.propertyInfo.cssText) {
|
||||
css = cssParse.removeCustomPropAssignment(css);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue