update polymer

This commit is contained in:
Luke Pulverenti 2015-07-09 23:00:03 -04:00
parent 568fabb9ca
commit 319d838d6e
48 changed files with 3045 additions and 2348 deletions

View file

@ -25,14 +25,14 @@
"web-component-tester": "*",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
},
"homepage": "https://github.com/polymerelements/iron-meta",
"homepage": "https://github.com/PolymerElements/iron-meta",
"_release": "1.0.3",
"_resolution": {
"type": "version",
"tag": "v1.0.3",
"commit": "91529259262b0d8f33fed44bc3fd47aedf35cb04"
},
"_source": "git://github.com/polymerelements/iron-meta.git",
"_source": "git://github.com/PolymerElements/iron-meta.git",
"_target": "^1.0.0",
"_originalSource": "polymerelements/iron-meta"
"_originalSource": "PolymerElements/iron-meta"
}

View file

@ -28,14 +28,14 @@
"web-component-tester": "*",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
},
"homepage": "https://github.com/PolymerElements/iron-selector",
"homepage": "https://github.com/polymerelements/iron-selector",
"_release": "1.0.2",
"_resolution": {
"type": "version",
"tag": "v1.0.2",
"commit": "ea22d91d11ba6f72c01faa952d5e600f9d1773cf"
},
"_source": "git://github.com/PolymerElements/iron-selector.git",
"_source": "git://github.com/polymerelements/iron-selector.git",
"_target": "^1.0.0",
"_originalSource": "PolymerElements/iron-selector"
"_originalSource": "polymerelements/iron-selector"
}

View file

@ -1,6 +1,6 @@
{
"name": "paper-drawer-panel",
"version": "1.0.2",
"version": "1.0.3",
"description": "A responsive drawer panel",
"authors": [
"The Polymer Authors"
@ -30,14 +30,13 @@
"web-component-tester": "*",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
},
"_release": "1.0.2",
"_release": "1.0.3",
"_resolution": {
"type": "version",
"tag": "v1.0.2",
"commit": "691739c877914f7231eaca16b724bdca295dfe8d"
"tag": "v1.0.3",
"commit": "92713b61eb8eec378db63af61b73341453b8180d"
},
"_source": "git://github.com/PolymerElements/paper-drawer-panel.git",
"_target": "~1.0.2",
"_originalSource": "PolymerElements/paper-drawer-panel",
"_direct": true
"_originalSource": "PolymerElements/paper-drawer-panel"
}

View file

@ -1,6 +1,6 @@
{
"name": "paper-drawer-panel",
"version": "1.0.2",
"version": "1.0.3",
"description": "A responsive drawer panel",
"authors": [
"The Polymer Authors"

View file

@ -16,10 +16,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<meta name="apple-mobile-web-app-capable" content="yes">
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="../../paper-styles/paper-styles.html">
<link rel="stylesheet" href="../../paper-styles/demo.css">
<link rel="import" href="../../paper-styles/demo-pages.html">
<link rel="import" href="../../paper-button/paper-button.html">
<link rel="import" href="../paper-drawer-panel.html">

File diff suppressed because it is too large Load diff

View file

@ -34,7 +34,7 @@
"tag": "v1.0.7",
"commit": "c65f5ce6b898bb756fca35cedaa53c3e8011abeb"
},
"_source": "git://github.com/polymerelements/paper-styles.git",
"_source": "git://github.com/PolymerElements/paper-styles.git",
"_target": "^1.0.0",
"_originalSource": "polymerelements/paper-styles"
"_originalSource": "PolymerElements/paper-styles"
}

View file

@ -1,6 +1,6 @@
{
"name": "polymer",
"version": "1.0.5",
"version": "1.0.6",
"main": [
"polymer.html"
],
@ -24,11 +24,11 @@
},
"private": true,
"homepage": "https://github.com/Polymer/polymer",
"_release": "1.0.5",
"_release": "1.0.6",
"_resolution": {
"type": "version",
"tag": "v1.0.5",
"commit": "b93f076d7b2606733d7166f311b77550deb98a39"
"tag": "v1.0.6",
"commit": "953fcba374812690c279abdacbfaf61e3e3aa347"
},
"_source": "git://github.com/Polymer/polymer.git",
"_target": "^1.0.0",

View file

@ -1,6 +1,6 @@
{
"name": "polymer",
"version": "1.0.5",
"version": "1.0.6",
"main": [
"polymer.html"
],

View file

@ -506,7 +506,7 @@ debouncer.stop();
}
}
});
Polymer.version = '1.0.5';
Polymer.version = '1.0.6';
Polymer.Base._addFeature({
_registerFeatures: function () {
this._prepIs();

View file

@ -426,6 +426,8 @@ var getInnerHTML = Polymer.domInnerHTML.getInnerHTML;
var nativeInsertBefore = Element.prototype.insertBefore;
var nativeRemoveChild = Element.prototype.removeChild;
var nativeAppendChild = Element.prototype.appendChild;
var nativeCloneNode = Element.prototype.cloneNode;
var nativeImportNode = Document.prototype.importNode;
var dirtyRoots = [];
var DomApi = function (node) {
this.node = node;
@ -554,8 +556,8 @@ return parentNeedsDist || hasContent && !wrappedContent;
},
_tryRemoveUndistributedNode: function (node) {
if (this.node.shadyRoot) {
if (node.parentNode) {
nativeRemoveChild.call(node.parentNode, node);
if (node._composedParent) {
nativeRemoveChild.call(node._composedParent, node);
}
return true;
}
@ -564,7 +566,7 @@ _updateInsertionPoints: function (host) {
host.shadyRoot._insertionPoints = factory(host.shadyRoot).querySelectorAll(CONTENT);
},
_nodeIsInLogicalTree: function (node) {
return Boolean(node._lightParent || node._isShadyRoot || this._ownerShadyRootForNode(node) || node.shadyRoot);
return Boolean(node._lightParent !== undefined || node._isShadyRoot || this._ownerShadyRootForNode(node) || node.shadyRoot);
},
_parentNeedsDistribution: function (parent) {
return parent && parent.shadyRoot && hasInsertionPoint(parent.shadyRoot);
@ -737,6 +739,31 @@ _distributeParent: function () {
if (this._parentNeedsDistribution(this.parentNode)) {
this._lazyDistribute(this.parentNode);
}
},
cloneNode: function (deep) {
var n = nativeCloneNode.call(this.node, false);
if (deep) {
var c$ = this.childNodes;
var d = factory(n);
for (var i = 0, nc; i < c$.length; i++) {
nc = factory(c$[i]).cloneNode(true);
d.appendChild(nc);
}
}
return n;
},
importNode: function (externalNode, deep) {
var doc = this.node instanceof HTMLDocument ? this.node : this.node.ownerDocument;
var n = nativeImportNode.call(doc, externalNode, false);
if (deep) {
var c$ = factory(externalNode).childNodes;
var d = factory(n);
for (var i = 0, nc; i < c$.length; i++) {
nc = factory(doc).importNode(c$[i], true);
d.appendChild(nc);
}
}
return n;
}
};
Object.defineProperty(DomApi.prototype, 'classList', {
@ -885,8 +912,9 @@ if (this.node.nodeType !== Node.TEXT_NODE) {
this._clear();
var d = document.createElement('div');
d.innerHTML = text;
for (var e = d.firstChild; e; e = e.nextSibling) {
this.appendChild(e);
var c$ = Array.prototype.slice.call(d.childNodes);
for (var i = 0; i < c$.length; i++) {
this.appendChild(c$[i]);
}
}
},
@ -909,6 +937,13 @@ 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 HTMLDocument ? this.node : this.node.ownerDocument;
return doc.importNode(externalNode, deep);
};
DomApi.prototype.getDestinationInsertionPoints = function () {
var n$ = this.node.getDestinationInsertionPoints();
return n$ ? Array.prototype.slice.call(n$) : [];

View file

@ -416,6 +416,7 @@ var MOUSE_EVENTS = [
'mouseup',
'click'
];
var IS_TOUCH_ONLY = navigator.userAgent.match(/iP(?:[oa]d|hone)|Android/);
var mouseCanceller = function (mouseEvent) {
mouseEvent[HANDLED_OBJ] = { skip: true };
if (mouseEvent.type === 'click') {
@ -440,6 +441,9 @@ document.removeEventListener(en, mouseCanceller, true);
}
}
function ignoreMouse() {
if (IS_TOUCH_ONLY) {
return;
}
if (!POINTERSTATE.mouse.mouseIgnoreJob) {
setupTeardownMouseCanceller(true);
}
@ -488,6 +492,12 @@ node = next;
}
return node;
},
findOriginalTarget: function (ev) {
if (ev.path) {
return ev.path[0];
}
return ev.target;
},
handleNative: function (ev) {
var handled;
var type = ev.type;
@ -558,8 +568,7 @@ prevent = dy > dx;
prevent = dx > dy;
}
if (prevent) {
//This breaks scrolling in safari
//ev.preventDefault();
ev.preventDefault();
}
}
},
@ -573,12 +582,18 @@ node[GESTURE_KEY] = gobj = {};
}
for (var i = 0, dep, gd; i < deps.length; i++) {
dep = deps[i];
if (IS_TOUCH_ONLY && MOUSE_EVENTS.indexOf(dep) > -1) {
continue;
}
gd = gobj[dep];
if (!gd) {
gobj[dep] = gd = {};
gobj[dep] = gd = { _count: 0 };
}
if (gd._count === 0) {
node.addEventListener(dep, this.handleNative);
}
gd[name] = (gd[name] || 0) + 1;
gd._count = (gd._count || 0) + 1;
}
node.addEventListener(evType, handler);
if (recognizer.touchAction) {
@ -596,9 +611,10 @@ dep = deps[i];
gd = gobj[dep];
if (gd && gd[name]) {
gd[name] = (gd[name] || 1) - 1;
if (gd[name] === 0) {
node.removeEventListener(dep, this.handleNative);
gd._count = (gd._count || 1) - 1;
}
if (gd._count === 0) {
node.removeEventListener(dep, this.handleNative);
}
}
}
@ -660,7 +676,7 @@ emits: [
'up'
],
mousedown: function (e) {
var t = e.currentTarget;
var t = Gestures.findOriginalTarget(e);
var self = this;
var upfn = function upfn(e) {
self.fire('up', t, e);
@ -670,10 +686,10 @@ document.addEventListener('mouseup', upfn);
this.fire('down', t, e);
},
touchstart: function (e) {
this.fire('down', e.currentTarget, e.changedTouches[0]);
this.fire('down', Gestures.findOriginalTarget(e), e.changedTouches[0]);
},
touchend: function (e) {
this.fire('up', e.currentTarget, e.changedTouches[0]);
this.fire('up', Gestures.findOriginalTarget(e), e.changedTouches[0]);
},
fire: function (type, target, event) {
var self = this;
@ -729,7 +745,7 @@ var dy = Math.abs(this.info.y - y);
return dx >= TRACK_DISTANCE || dy >= TRACK_DISTANCE;
},
mousedown: function (e) {
var t = e.currentTarget;
var t = Gestures.findOriginalTarget(e);
var self = this;
var movefn = function movefn(e) {
var x = e.clientX, y = e.clientY;
@ -763,7 +779,7 @@ this.info.x = ct.clientX;
this.info.y = ct.clientY;
},
touchmove: function (e) {
var t = e.currentTarget;
var t = Gestures.findOriginalTarget(e);
var ct = e.changedTouches[0];
var x = ct.clientX, y = ct.clientY;
if (this.hasMovedEnough(x, y)) {
@ -777,7 +793,7 @@ this.info.started = true;
}
},
touchend: function (e) {
var t = e.currentTarget;
var t = Gestures.findOriginalTarget(e);
var ct = e.changedTouches[0];
if (this.info.started) {
Gestures.prevent('tap');
@ -853,9 +869,10 @@ this.forward(e.changedTouches[0]);
forward: function (e) {
var dx = Math.abs(e.clientX - this.info.x);
var dy = Math.abs(e.clientY - this.info.y);
var t = Gestures.findOriginalTarget(e);
if (isNaN(dx) || isNaN(dy) || dx <= TAP_DISTANCE && dy <= TAP_DISTANCE) {
if (!this.info.prevent) {
Gestures.fire(e.target, 'tap', {
Gestures.fire(t, 'tap', {
x: e.clientX,
y: e.clientY,
sourceEvent: e
@ -1102,15 +1119,15 @@ Polymer.Bind = {
prepareModel: function (model) {
model._propertyEffects = {};
model._bindListeners = [];
var api = this._modelApi;
for (var n in api) {
model[n] = api[n];
}
Polymer.Base.mixin(model, this._modelApi);
},
_modelApi: {
_notifyChange: function (property) {
var eventName = Polymer.CaseMap.camelToDashCase(property) + '-changed';
this.fire(eventName, { value: this[property] }, { bubbles: false });
Polymer.Base.fire(eventName, { value: this[property] }, {
bubbles: false,
node: this
});
},
_propertySetter: function (property, value, effects, fromAbove) {
var old = this.__data__[property];
@ -1201,8 +1218,11 @@ return this.__data__[property];
var setter = function (value) {
this._propertySetter(property, value, effects);
};
if (model.getPropertyInfo && model.getPropertyInfo(property).readOnly) {
var info = model.getPropertyInfo && model.getPropertyInfo(property);
if (info && info.readOnly) {
if (!info.computed) {
model['_set' + this.upper(property)] = setter;
}
} else {
defun.set = setter;
}
@ -1660,6 +1680,7 @@ this._pathEffector(path, value);
if (!fromAbove) {
this._notifyPath(path, value);
}
return true;
}
},
_getPathParts: function (path) {
@ -2001,7 +2022,7 @@ var VAR_START = '--';
var MEDIA_START = '@media';
var AT_START = '@';
var rx = {
comments: /\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,
comments: /\/\*[^*]*\*+([^\/*][^*]*\*+)*\//gim,
port: /@import[^;]*;/gim,
customProp: /(?:^|[\s;])--[^;{]*?:[^{};]*?(?:[;\n]|$)/gim,
mixinProp: /(?:^|[\s;])--[^;{]*?:[^{;]*?{[^}]*?}(?:[;\n]|$)?/gim,
@ -2673,10 +2694,10 @@ props[i] = v;
}
},
rx: {
VAR_ASSIGN: /(?:^|[;\n]\s*)(--[\w-]*?):\s*?(?:([^;{]*?)|{([^}]*)})(?:(?=[;\n])|$)/gim,
MIXIN_MATCH: /(?:^|\W+)@apply[\s]*\(([^)]*)\)/im,
VAR_MATCH: /(^|\W+)var\([\s]*([^,)]*)[\s]*,?[\s]*((?:[^,)]*)|(?:[^;]*\([^;)]*\)))[\s]*?\)/gim,
VAR_CAPTURE: /\([\s]*(--[^,\s)]*)(?:,[\s]*(--[^,\s)]*))?(?:\)|,)/gim,
VAR_ASSIGN: /(?:^|[;\n]\s*)(--[\w-]*?):\s*(?:([^;{]*)|{([^}]*)})(?:(?=[;\n])|$)/gi,
MIXIN_MATCH: /(?:^|\W+)@apply[\s]*\(([^)]*)\)/i,
VAR_MATCH: /(^|\W+)var\([\s]*([^,)]*)[\s]*,?[\s]*((?:[^,)]*)|(?:[^;]*\([^;)]*\)))[\s]*?\)/gi,
VAR_CAPTURE: /\([\s]*(--[^,\s)]*)(?:,[\s]*(--[^,\s)]*))?(?:\)|,)/gi,
IS_VAR: /^--/,
BRACKETED: /\{[^}]*\}/g,
HOST_PREFIX: '(?:^|[^.#[:])',
@ -3015,7 +3036,7 @@ styleTransformer.documentRule(rule);
});
}());
Polymer.Templatizer = {
properties: { _hideTemplateChildren: { observer: '_showHideChildren' } },
properties: { __hideTemplateChildren__: { observer: '_showHideChildren' } },
_templatizerStatic: {
count: 0,
callbacks: {},
@ -3044,6 +3065,7 @@ this._prepParentProperties(archetype, template);
archetype._notifyPath = this._notifyPathImpl;
archetype._scopeElementClass = this._scopeElementClassImpl;
archetype.listen = this._listenImpl;
archetype._showHideChildren = this._showHideChildrenImpl;
var _constructor = this._constructorImpl;
var ctor = function TemplateInstance(model, host) {
_constructor.call(this, model, host);
@ -3056,7 +3078,15 @@ this.ctor = ctor;
_getRootDataHost: function () {
return this.dataHost && this.dataHost._rootDataHost || this.dataHost;
},
_showHideChildren: function (hidden) {
_showHideChildrenImpl: function (hide) {
var c = this._children;
for (var i = 0; i < c.length; i++) {
var n = c[i];
if (n.style) {
n.style.display = hide ? 'none' : '';
n.__hideTemplateChildren__ = hide;
}
}
},
_debounceTemplate: function (fn) {
this._templatizerStatic.callbacks[this._templatizerId] = fn.bind(this);
@ -3157,6 +3187,8 @@ template._propertySetter(n, val);
}
});
},
_showHideChildren: function (hidden) {
},
_forwardInstancePath: function (inst, path, value) {
},
_forwardInstanceProp: function (inst, prop, value) {
@ -3195,6 +3227,9 @@ children.push(n);
n._templateInstance = this;
}
this._children = children;
if (host.__hideTemplateChildren__) {
this._showHideChildren(true);
}
this._tryReady();
},
_listenImpl: function (node, eventName, methodName) {
@ -3221,6 +3256,20 @@ model[prop] = this['_parent_' + prop];
}
}
return new this.ctor(model, this);
},
modelForElement: function (el) {
var model;
while (el) {
if (model = el._templateInstance) {
if (model.dataHost != this) {
el = model.dataHost;
} else {
return model;
}
} else {
el = el.parentNode;
}
}
}
};
Polymer({
@ -3267,7 +3316,7 @@ this._removeFromMap(this.store[key]);
delete this.store[key];
},
_removeFromMap: function (item) {
if (typeof item == 'object') {
if (item && typeof item == 'object') {
this.omap.delete(item);
} else {
delete this.pmap[item];
@ -3279,7 +3328,7 @@ this.removeKey(key);
return key;
},
getKey: function (item) {
if (typeof item == 'object') {
if (item && typeof item == 'object') {
return this.omap.get(item);
} else {
return this.pmap[item];
@ -3648,14 +3697,7 @@ return row;
_showHideChildren: function (hidden) {
if (this.rows) {
for (var i = 0; i < this.rows.length; i++) {
var c$ = this.rows[i]._children;
for (var j = 0; j < c$.length; j++) {
var c = c$[j];
if (c.style) {
c.style.display = hidden ? 'none' : '';
}
c._hideTemplateChildren = hidden;
}
this.rows[i]._showHideChildren(hidden);
}
}
},
@ -3705,20 +3747,6 @@ row.__setProperty(this.as, value, true);
}
}
},
modelForElement: function (el) {
var model;
while (el) {
if (model = el._templateInstance) {
if (model.dataHost != this) {
el = model.dataHost;
} else {
return model;
}
} else {
el = el.parentNode;
}
}
},
itemForElement: function (el) {
var instance = this.modelForElement(el);
return instance && instance[this.as];
@ -3873,7 +3901,7 @@ this._instance = null;
},
_wrapTextNodes: function (root) {
for (var n = root.firstChild; n; n = n.nextSibling) {
if (n.nodeType === Node.TEXT_NODE) {
if (n.nodeType === Node.TEXT_NODE && n.textContent.trim()) {
var s = document.createElement('span');
root.insertBefore(s, n);
s.appendChild(n);
@ -3882,14 +3910,9 @@ n = s;
}
},
_showHideChildren: function () {
var hidden = this._hideTemplateChildren || !this.if;
var hidden = this.__hideTemplateChildren__ || !this.if;
if (this._instance) {
var c$ = this._instance._children;
for (var i = 0; i < c$.length; i++) {
var c = c$[i];
c.style.display = hidden ? 'none' : '';
c._hideTemplateChildren = hidden;
}
this._instance._showHideChildren(hidden);
}
},
_forwardParentProp: function (prop, value) {

View file

@ -1,7 +1,7 @@
{
"name": "webcomponentsjs",
"main": "webcomponents.js",
"version": "0.7.5",
"version": "0.7.6",
"homepage": "http://webcomponents.org",
"authors": [
"The Polymer Authors"
@ -15,11 +15,11 @@
],
"license": "BSD",
"ignore": [],
"_release": "0.7.5",
"_release": "0.7.6",
"_resolution": {
"type": "version",
"tag": "v0.7.5",
"commit": "6e2fd746392a9fbec95711872e21fa22bff22fae"
"tag": "v0.7.6",
"commit": "401764710ac11f9ed8a175195107752af2f72eb6"
},
"_source": "git://github.com/Polymer/webcomponentsjs.git",
"_target": "^0.7.2",

View file

@ -7,7 +7,7 @@
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/
// @version 0.7.5
// @version 0.7.6
if (typeof WeakMap === "undefined") {
(function() {
var defineProperty = Object.defineProperty;
@ -423,30 +423,24 @@ window.CustomElements.addModule(function(scope) {
var flags = scope.flags;
var forSubtree = scope.forSubtree;
var forDocumentTree = scope.forDocumentTree;
function addedNode(node) {
return added(node) || addedSubtree(node);
function addedNode(node, isAttached) {
return added(node, isAttached) || addedSubtree(node, isAttached);
}
function added(node) {
if (scope.upgrade(node)) {
function added(node, isAttached) {
if (scope.upgrade(node, isAttached)) {
return true;
}
attached(node);
if (isAttached) {
attached(node);
}
}
function addedSubtree(node) {
function addedSubtree(node, isAttached) {
forSubtree(node, function(e) {
if (added(e)) {
if (added(e, isAttached)) {
return true;
}
});
}
function attachedNode(node) {
attached(node);
if (inDocument(node)) {
forSubtree(node, function(e) {
attached(e);
});
}
}
var hasPolyfillMutations = !window.MutationObserver || window.MutationObserver === window.JsMutationObserver;
scope.hasPolyfillMutations = hasPolyfillMutations;
var isPendingMutations = false;
@ -476,12 +470,10 @@ window.CustomElements.addModule(function(scope) {
}
}
function _attached(element) {
if (element.__upgraded__ && (element.attachedCallback || element.detachedCallback)) {
if (!element.__attached && inDocument(element)) {
element.__attached = true;
if (element.attachedCallback) {
element.attachedCallback();
}
if (element.__upgraded__ && !element.__attached) {
element.__attached = true;
if (element.attachedCallback) {
element.attachedCallback();
}
}
}
@ -501,18 +493,16 @@ window.CustomElements.addModule(function(scope) {
}
}
function _detached(element) {
if (element.__upgraded__ && (element.attachedCallback || element.detachedCallback)) {
if (element.__attached && !inDocument(element)) {
element.__attached = false;
if (element.detachedCallback) {
element.detachedCallback();
}
if (element.__upgraded__ && element.__attached) {
element.__attached = false;
if (element.detachedCallback) {
element.detachedCallback();
}
}
}
function inDocument(element) {
var p = element;
var doc = wrap(document);
var doc = window.wrap(document);
while (p) {
if (p == doc) {
return true;
@ -530,7 +520,7 @@ window.CustomElements.addModule(function(scope) {
}
}
}
function handler(mutations) {
function handler(root, mutations) {
if (flags.dom) {
var mx = mutations[0];
if (mx && mx.type === "childList" && mx.addedNodes) {
@ -545,13 +535,14 @@ window.CustomElements.addModule(function(scope) {
}
console.group("mutations (%d) [%s]", mutations.length, u || "");
}
var isAttached = inDocument(root);
mutations.forEach(function(mx) {
if (mx.type === "childList") {
forEach(mx.addedNodes, function(n) {
if (!n.localName) {
return;
}
addedNode(n);
addedNode(n, isAttached);
});
forEach(mx.removedNodes, function(n) {
if (!n.localName) {
@ -573,7 +564,7 @@ window.CustomElements.addModule(function(scope) {
}
var observer = node.__observer;
if (observer) {
handler(observer.takeRecords());
handler(node, observer.takeRecords());
takeMutations();
}
}
@ -582,7 +573,7 @@ window.CustomElements.addModule(function(scope) {
if (inRoot.__observer) {
return;
}
var observer = new MutationObserver(handler);
var observer = new MutationObserver(handler.bind(this, inRoot));
observer.observe(inRoot, {
childList: true,
subtree: true
@ -592,7 +583,8 @@ window.CustomElements.addModule(function(scope) {
function upgradeDocument(doc) {
doc = window.wrap(doc);
flags.dom && console.group("upgradeDocument: ", doc.baseURI.split("/").pop());
addedNode(doc);
var isMainDocument = doc === window.wrap(document);
addedNode(doc, isMainDocument);
observe(doc);
flags.dom && console.groupEnd();
}
@ -611,26 +603,26 @@ window.CustomElements.addModule(function(scope) {
scope.upgradeDocumentTree = upgradeDocumentTree;
scope.upgradeSubtree = addedSubtree;
scope.upgradeAll = addedNode;
scope.attachedNode = attachedNode;
scope.attached = attached;
scope.takeRecords = takeRecords;
});
window.CustomElements.addModule(function(scope) {
var flags = scope.flags;
function upgrade(node) {
function upgrade(node, isAttached) {
if (!node.__upgraded__ && node.nodeType === Node.ELEMENT_NODE) {
var is = node.getAttribute("is");
var definition = scope.getRegisteredDefinition(is || node.localName);
if (definition) {
if (is && definition.tag == node.localName) {
return upgradeWithDefinition(node, definition);
return upgradeWithDefinition(node, definition, isAttached);
} else if (!is && !definition.extends) {
return upgradeWithDefinition(node, definition);
return upgradeWithDefinition(node, definition, isAttached);
}
}
}
}
function upgradeWithDefinition(element, definition) {
function upgradeWithDefinition(element, definition, isAttached) {
flags.upgrade && console.group("upgrade:", element.localName);
if (definition.is) {
element.setAttribute("is", definition.is);
@ -638,8 +630,10 @@ window.CustomElements.addModule(function(scope) {
implementPrototype(element, definition);
element.__upgraded__ = true;
created(element);
scope.attachedNode(element);
scope.upgradeSubtree(element);
if (isAttached) {
scope.attached(element);
}
scope.upgradeSubtree(element, isAttached);
flags.upgrade && console.groupEnd();
return element;
}
@ -921,7 +915,7 @@ window.CustomElements.addModule(function(scope) {
upgradeDocumentTree(window.wrap(document));
if (window.HTMLImports) {
window.HTMLImports.__importsParsingHook = function(elt) {
upgradeDocumentTree(wrap(elt.import));
upgradeDocumentTree(window.wrap(elt.import));
};
}
window.CustomElements.ready = true;

File diff suppressed because one or more lines are too long

View file

@ -7,7 +7,7 @@
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/
// @version 0.7.5
// @version 0.7.6
if (typeof WeakMap === "undefined") {
(function() {
var defineProperty = Object.defineProperty;
@ -847,7 +847,9 @@ window.HTMLImports.addModule(function(scope) {
script.src = scriptElt.src ? scriptElt.src : generateScriptDataUrl(scriptElt);
scope.currentScript = scriptElt;
this.trackElement(script, function(e) {
script.parentNode.removeChild(script);
if (script.parentNode) {
script.parentNode.removeChild(script);
}
scope.currentScript = null;
});
this.addElementToDocument(script);

File diff suppressed because one or more lines are too long

View file

@ -7,7 +7,7 @@
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/
// @version 0.7.5
// @version 0.7.6
if (typeof WeakMap === "undefined") {
(function() {
var defineProperty = Object.defineProperty;

File diff suppressed because one or more lines are too long

View file

@ -7,7 +7,7 @@
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/
// @version 0.7.5
// @version 0.7.6
if (typeof WeakMap === "undefined") {
(function() {
var defineProperty = Object.defineProperty;

File diff suppressed because one or more lines are too long

View file

@ -1,7 +1,7 @@
{
"name": "webcomponentsjs",
"main": "webcomponents.js",
"version": "0.7.5",
"version": "0.7.6",
"homepage": "http://webcomponents.org",
"authors": [
"The Polymer Authors"

View file

@ -1,6 +1,6 @@
{
"name": "webcomponents.js",
"version": "0.7.5",
"version": "0.7.6",
"description": "webcomponents.js",
"main": "webcomponents.js",
"directories": {

View file

@ -7,7 +7,7 @@
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/
// @version 0.7.5
// @version 0.7.6
window.WebComponents = window.WebComponents || {};
(function(scope) {
@ -1415,7 +1415,9 @@ window.HTMLImports.addModule(function(scope) {
script.src = scriptElt.src ? scriptElt.src : generateScriptDataUrl(scriptElt);
scope.currentScript = scriptElt;
this.trackElement(script, function(e) {
script.parentNode.removeChild(script);
if (script.parentNode) {
script.parentNode.removeChild(script);
}
scope.currentScript = null;
});
this.addElementToDocument(script);
@ -1732,30 +1734,24 @@ window.CustomElements.addModule(function(scope) {
var flags = scope.flags;
var forSubtree = scope.forSubtree;
var forDocumentTree = scope.forDocumentTree;
function addedNode(node) {
return added(node) || addedSubtree(node);
function addedNode(node, isAttached) {
return added(node, isAttached) || addedSubtree(node, isAttached);
}
function added(node) {
if (scope.upgrade(node)) {
function added(node, isAttached) {
if (scope.upgrade(node, isAttached)) {
return true;
}
attached(node);
if (isAttached) {
attached(node);
}
}
function addedSubtree(node) {
function addedSubtree(node, isAttached) {
forSubtree(node, function(e) {
if (added(e)) {
if (added(e, isAttached)) {
return true;
}
});
}
function attachedNode(node) {
attached(node);
if (inDocument(node)) {
forSubtree(node, function(e) {
attached(e);
});
}
}
var hasPolyfillMutations = !window.MutationObserver || window.MutationObserver === window.JsMutationObserver;
scope.hasPolyfillMutations = hasPolyfillMutations;
var isPendingMutations = false;
@ -1785,12 +1781,10 @@ window.CustomElements.addModule(function(scope) {
}
}
function _attached(element) {
if (element.__upgraded__ && (element.attachedCallback || element.detachedCallback)) {
if (!element.__attached && inDocument(element)) {
element.__attached = true;
if (element.attachedCallback) {
element.attachedCallback();
}
if (element.__upgraded__ && !element.__attached) {
element.__attached = true;
if (element.attachedCallback) {
element.attachedCallback();
}
}
}
@ -1810,18 +1804,16 @@ window.CustomElements.addModule(function(scope) {
}
}
function _detached(element) {
if (element.__upgraded__ && (element.attachedCallback || element.detachedCallback)) {
if (element.__attached && !inDocument(element)) {
element.__attached = false;
if (element.detachedCallback) {
element.detachedCallback();
}
if (element.__upgraded__ && element.__attached) {
element.__attached = false;
if (element.detachedCallback) {
element.detachedCallback();
}
}
}
function inDocument(element) {
var p = element;
var doc = wrap(document);
var doc = window.wrap(document);
while (p) {
if (p == doc) {
return true;
@ -1839,7 +1831,7 @@ window.CustomElements.addModule(function(scope) {
}
}
}
function handler(mutations) {
function handler(root, mutations) {
if (flags.dom) {
var mx = mutations[0];
if (mx && mx.type === "childList" && mx.addedNodes) {
@ -1854,13 +1846,14 @@ window.CustomElements.addModule(function(scope) {
}
console.group("mutations (%d) [%s]", mutations.length, u || "");
}
var isAttached = inDocument(root);
mutations.forEach(function(mx) {
if (mx.type === "childList") {
forEach(mx.addedNodes, function(n) {
if (!n.localName) {
return;
}
addedNode(n);
addedNode(n, isAttached);
});
forEach(mx.removedNodes, function(n) {
if (!n.localName) {
@ -1882,7 +1875,7 @@ window.CustomElements.addModule(function(scope) {
}
var observer = node.__observer;
if (observer) {
handler(observer.takeRecords());
handler(node, observer.takeRecords());
takeMutations();
}
}
@ -1891,7 +1884,7 @@ window.CustomElements.addModule(function(scope) {
if (inRoot.__observer) {
return;
}
var observer = new MutationObserver(handler);
var observer = new MutationObserver(handler.bind(this, inRoot));
observer.observe(inRoot, {
childList: true,
subtree: true
@ -1901,7 +1894,8 @@ window.CustomElements.addModule(function(scope) {
function upgradeDocument(doc) {
doc = window.wrap(doc);
flags.dom && console.group("upgradeDocument: ", doc.baseURI.split("/").pop());
addedNode(doc);
var isMainDocument = doc === window.wrap(document);
addedNode(doc, isMainDocument);
observe(doc);
flags.dom && console.groupEnd();
}
@ -1920,26 +1914,26 @@ window.CustomElements.addModule(function(scope) {
scope.upgradeDocumentTree = upgradeDocumentTree;
scope.upgradeSubtree = addedSubtree;
scope.upgradeAll = addedNode;
scope.attachedNode = attachedNode;
scope.attached = attached;
scope.takeRecords = takeRecords;
});
window.CustomElements.addModule(function(scope) {
var flags = scope.flags;
function upgrade(node) {
function upgrade(node, isAttached) {
if (!node.__upgraded__ && node.nodeType === Node.ELEMENT_NODE) {
var is = node.getAttribute("is");
var definition = scope.getRegisteredDefinition(is || node.localName);
if (definition) {
if (is && definition.tag == node.localName) {
return upgradeWithDefinition(node, definition);
return upgradeWithDefinition(node, definition, isAttached);
} else if (!is && !definition.extends) {
return upgradeWithDefinition(node, definition);
return upgradeWithDefinition(node, definition, isAttached);
}
}
}
}
function upgradeWithDefinition(element, definition) {
function upgradeWithDefinition(element, definition, isAttached) {
flags.upgrade && console.group("upgrade:", element.localName);
if (definition.is) {
element.setAttribute("is", definition.is);
@ -1947,8 +1941,10 @@ window.CustomElements.addModule(function(scope) {
implementPrototype(element, definition);
element.__upgraded__ = true;
created(element);
scope.attachedNode(element);
scope.upgradeSubtree(element);
if (isAttached) {
scope.attached(element);
}
scope.upgradeSubtree(element, isAttached);
flags.upgrade && console.groupEnd();
return element;
}
@ -2230,7 +2226,7 @@ window.CustomElements.addModule(function(scope) {
upgradeDocumentTree(window.wrap(document));
if (window.HTMLImports) {
window.HTMLImports.__importsParsingHook = function(elt) {
upgradeDocumentTree(wrap(elt.import));
upgradeDocumentTree(window.wrap(elt.import));
};
}
window.CustomElements.ready = true;

File diff suppressed because one or more lines are too long

View file

@ -7,7 +7,7 @@
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/
// @version 0.7.5
// @version 0.7.6
window.WebComponents = window.WebComponents || {};
(function(scope) {
@ -6184,7 +6184,9 @@ window.HTMLImports.addModule(function(scope) {
script.src = scriptElt.src ? scriptElt.src : generateScriptDataUrl(scriptElt);
scope.currentScript = scriptElt;
this.trackElement(script, function(e) {
script.parentNode.removeChild(script);
if (script.parentNode) {
script.parentNode.removeChild(script);
}
scope.currentScript = null;
});
this.addElementToDocument(script);
@ -6501,30 +6503,24 @@ window.CustomElements.addModule(function(scope) {
var flags = scope.flags;
var forSubtree = scope.forSubtree;
var forDocumentTree = scope.forDocumentTree;
function addedNode(node) {
return added(node) || addedSubtree(node);
function addedNode(node, isAttached) {
return added(node, isAttached) || addedSubtree(node, isAttached);
}
function added(node) {
if (scope.upgrade(node)) {
function added(node, isAttached) {
if (scope.upgrade(node, isAttached)) {
return true;
}
attached(node);
if (isAttached) {
attached(node);
}
}
function addedSubtree(node) {
function addedSubtree(node, isAttached) {
forSubtree(node, function(e) {
if (added(e)) {
if (added(e, isAttached)) {
return true;
}
});
}
function attachedNode(node) {
attached(node);
if (inDocument(node)) {
forSubtree(node, function(e) {
attached(e);
});
}
}
var hasPolyfillMutations = !window.MutationObserver || window.MutationObserver === window.JsMutationObserver;
scope.hasPolyfillMutations = hasPolyfillMutations;
var isPendingMutations = false;
@ -6554,12 +6550,10 @@ window.CustomElements.addModule(function(scope) {
}
}
function _attached(element) {
if (element.__upgraded__ && (element.attachedCallback || element.detachedCallback)) {
if (!element.__attached && inDocument(element)) {
element.__attached = true;
if (element.attachedCallback) {
element.attachedCallback();
}
if (element.__upgraded__ && !element.__attached) {
element.__attached = true;
if (element.attachedCallback) {
element.attachedCallback();
}
}
}
@ -6579,18 +6573,16 @@ window.CustomElements.addModule(function(scope) {
}
}
function _detached(element) {
if (element.__upgraded__ && (element.attachedCallback || element.detachedCallback)) {
if (element.__attached && !inDocument(element)) {
element.__attached = false;
if (element.detachedCallback) {
element.detachedCallback();
}
if (element.__upgraded__ && element.__attached) {
element.__attached = false;
if (element.detachedCallback) {
element.detachedCallback();
}
}
}
function inDocument(element) {
var p = element;
var doc = wrap(document);
var doc = window.wrap(document);
while (p) {
if (p == doc) {
return true;
@ -6608,7 +6600,7 @@ window.CustomElements.addModule(function(scope) {
}
}
}
function handler(mutations) {
function handler(root, mutations) {
if (flags.dom) {
var mx = mutations[0];
if (mx && mx.type === "childList" && mx.addedNodes) {
@ -6623,13 +6615,14 @@ window.CustomElements.addModule(function(scope) {
}
console.group("mutations (%d) [%s]", mutations.length, u || "");
}
var isAttached = inDocument(root);
mutations.forEach(function(mx) {
if (mx.type === "childList") {
forEach(mx.addedNodes, function(n) {
if (!n.localName) {
return;
}
addedNode(n);
addedNode(n, isAttached);
});
forEach(mx.removedNodes, function(n) {
if (!n.localName) {
@ -6651,7 +6644,7 @@ window.CustomElements.addModule(function(scope) {
}
var observer = node.__observer;
if (observer) {
handler(observer.takeRecords());
handler(node, observer.takeRecords());
takeMutations();
}
}
@ -6660,7 +6653,7 @@ window.CustomElements.addModule(function(scope) {
if (inRoot.__observer) {
return;
}
var observer = new MutationObserver(handler);
var observer = new MutationObserver(handler.bind(this, inRoot));
observer.observe(inRoot, {
childList: true,
subtree: true
@ -6670,7 +6663,8 @@ window.CustomElements.addModule(function(scope) {
function upgradeDocument(doc) {
doc = window.wrap(doc);
flags.dom && console.group("upgradeDocument: ", doc.baseURI.split("/").pop());
addedNode(doc);
var isMainDocument = doc === window.wrap(document);
addedNode(doc, isMainDocument);
observe(doc);
flags.dom && console.groupEnd();
}
@ -6689,26 +6683,26 @@ window.CustomElements.addModule(function(scope) {
scope.upgradeDocumentTree = upgradeDocumentTree;
scope.upgradeSubtree = addedSubtree;
scope.upgradeAll = addedNode;
scope.attachedNode = attachedNode;
scope.attached = attached;
scope.takeRecords = takeRecords;
});
window.CustomElements.addModule(function(scope) {
var flags = scope.flags;
function upgrade(node) {
function upgrade(node, isAttached) {
if (!node.__upgraded__ && node.nodeType === Node.ELEMENT_NODE) {
var is = node.getAttribute("is");
var definition = scope.getRegisteredDefinition(is || node.localName);
if (definition) {
if (is && definition.tag == node.localName) {
return upgradeWithDefinition(node, definition);
return upgradeWithDefinition(node, definition, isAttached);
} else if (!is && !definition.extends) {
return upgradeWithDefinition(node, definition);
return upgradeWithDefinition(node, definition, isAttached);
}
}
}
}
function upgradeWithDefinition(element, definition) {
function upgradeWithDefinition(element, definition, isAttached) {
flags.upgrade && console.group("upgrade:", element.localName);
if (definition.is) {
element.setAttribute("is", definition.is);
@ -6716,8 +6710,10 @@ window.CustomElements.addModule(function(scope) {
implementPrototype(element, definition);
element.__upgraded__ = true;
created(element);
scope.attachedNode(element);
scope.upgradeSubtree(element);
if (isAttached) {
scope.attached(element);
}
scope.upgradeSubtree(element, isAttached);
flags.upgrade && console.groupEnd();
return element;
}
@ -6999,7 +6995,7 @@ window.CustomElements.addModule(function(scope) {
upgradeDocumentTree(window.wrap(document));
if (window.HTMLImports) {
window.HTMLImports.__importsParsingHook = function(elt) {
upgradeDocumentTree(wrap(elt.import));
upgradeDocumentTree(window.wrap(elt.import));
};
}
window.CustomElements.ready = true;

File diff suppressed because one or more lines are too long