| Index: third_party/polymer/v1_0/components-chromium/polymer/polymer-mini-extracted.js
|
| diff --git a/third_party/polymer/v1_0/components-chromium/polymer/polymer-mini-extracted.js b/third_party/polymer/v1_0/components-chromium/polymer/polymer-mini-extracted.js
|
| index ff4e1087e5be53d5efa700b57c1c5225bbe08db2..d5bef3c6b790979014078421df6fb4a2eb4f831e 100644
|
| --- a/third_party/polymer/v1_0/components-chromium/polymer/polymer-mini-extracted.js
|
| +++ b/third_party/polymer/v1_0/components-chromium/polymer/polymer-mini-extracted.js
|
| @@ -1,65 +1,65 @@
|
| Polymer.Base._addFeature({
|
| -_prepTemplate: function() {
|
| -this._template = this._template || Polymer.DomModule.import(this.is, "template");
|
| +_prepTemplate: function () {
|
| +this._template = this._template || Polymer.DomModule.import(this.is, 'template');
|
| if (!this._template) {
|
| var script = document._currentScript || document.currentScript;
|
| var prev = script && script.previousElementSibling;
|
| -if (prev && prev.localName === "template") {
|
| +if (prev && prev.localName === 'template') {
|
| this._template = prev;
|
| }
|
| }
|
| -if (this._template && this._template.hasAttribute("is")) {
|
| -this._warn(this._logf("_prepTemplate", "top-level Polymer template " + "must not be a type-extension, found", this._template, "Move inside simple <template>."));
|
| +if (this._template && this._template.hasAttribute('is')) {
|
| +this._warn(this._logf('_prepTemplate', 'top-level Polymer template ' + 'must not be a type-extension, found', this._template, 'Move inside simple <template>.'));
|
| }
|
| },
|
| -_stampTemplate: function() {
|
| +_stampTemplate: function () {
|
| if (this._template) {
|
| this.root = this.instanceTemplate(this._template);
|
| }
|
| },
|
| -instanceTemplate: function(template) {
|
| +instanceTemplate: function (template) {
|
| var dom = document.importNode(template._content || template.content, true);
|
| return dom;
|
| }
|
| });
|
| -
|
| -(function() {
|
| +(function () {
|
| var baseAttachedCallback = Polymer.Base.attachedCallback;
|
| Polymer.Base._addFeature({
|
| _hostStack: [],
|
| -ready: function() {},
|
| -_pushHost: function(host) {
|
| +ready: function () {
|
| +},
|
| +_pushHost: function (host) {
|
| this.dataHost = host = host || Polymer.Base._hostStack[Polymer.Base._hostStack.length - 1];
|
| if (host && host._clients) {
|
| host._clients.push(this);
|
| }
|
| this._beginHost();
|
| },
|
| -_beginHost: function() {
|
| +_beginHost: function () {
|
| Polymer.Base._hostStack.push(this);
|
| if (!this._clients) {
|
| this._clients = [];
|
| }
|
| },
|
| -_popHost: function() {
|
| +_popHost: function () {
|
| Polymer.Base._hostStack.pop();
|
| },
|
| -_tryReady: function() {
|
| +_tryReady: function () {
|
| if (this._canReady()) {
|
| this._ready();
|
| }
|
| },
|
| -_canReady: function() {
|
| +_canReady: function () {
|
| return !this.dataHost || this.dataHost._clientsReadied;
|
| },
|
| -_ready: function() {
|
| +_ready: function () {
|
| this._beforeClientsReady();
|
| this._setupRoot();
|
| this._readyClients();
|
| this._afterClientsReady();
|
| this._readySelf();
|
| },
|
| -_readyClients: function() {
|
| +_readyClients: function () {
|
| this._beginDistribute();
|
| var c$ = this._clients;
|
| for (var i = 0, l = c$.length, c; i < l && (c = c$[i]); i++) {
|
| @@ -69,18 +69,21 @@ this._finishDistribute();
|
| this._clientsReadied = true;
|
| this._clients = null;
|
| },
|
| -_readySelf: function() {
|
| -this._doBehavior("ready");
|
| +_readySelf: function () {
|
| +this._doBehavior('ready');
|
| this._readied = true;
|
| if (this._attachedPending) {
|
| this._attachedPending = false;
|
| this.attachedCallback();
|
| }
|
| },
|
| -_beforeClientsReady: function() {},
|
| -_afterClientsReady: function() {},
|
| -_beforeAttached: function() {},
|
| -attachedCallback: function() {
|
| +_beforeClientsReady: function () {
|
| +},
|
| +_afterClientsReady: function () {
|
| +},
|
| +_beforeAttached: function () {
|
| +},
|
| +attachedCallback: function () {
|
| if (this._readied) {
|
| this._beforeAttached();
|
| baseAttachedCallback.call(this);
|
| @@ -89,9 +92,8 @@ this._attachedPending = true;
|
| }
|
| }
|
| });
|
| -})();
|
| -
|
| -Polymer.ArraySplice = function() {
|
| +}());
|
| +Polymer.ArraySplice = function () {
|
| function newSplice(index, removed, addedCount) {
|
| return {
|
| index: index,
|
| @@ -103,9 +105,10 @@ var EDIT_LEAVE = 0;
|
| var EDIT_UPDATE = 1;
|
| var EDIT_ADD = 2;
|
| var EDIT_DELETE = 3;
|
| -function ArraySplice() {}
|
| +function ArraySplice() {
|
| +}
|
| ArraySplice.prototype = {
|
| -calcEditDistances: function(current, currentStart, currentEnd, old, oldStart, oldEnd) {
|
| +calcEditDistances: function (current, currentStart, currentEnd, old, oldStart, oldEnd) {
|
| var rowCount = oldEnd - oldStart + 1;
|
| var columnCount = currentEnd - currentStart + 1;
|
| var distances = new Array(rowCount);
|
| @@ -113,10 +116,13 @@ for (var i = 0; i < rowCount; i++) {
|
| distances[i] = new Array(columnCount);
|
| distances[i][0] = i;
|
| }
|
| -for (var j = 0; j < columnCount; j++) distances[0][j] = j;
|
| +for (var j = 0; j < columnCount; j++)
|
| +distances[0][j] = j;
|
| for (var i = 1; i < rowCount; i++) {
|
| for (var j = 1; j < columnCount; j++) {
|
| -if (this.equals(current[currentStart + j - 1], old[oldStart + i - 1])) distances[i][j] = distances[i - 1][j - 1]; else {
|
| +if (this.equals(current[currentStart + j - 1], old[oldStart + i - 1]))
|
| +distances[i][j] = distances[i - 1][j - 1];
|
| +else {
|
| var north = distances[i - 1][j] + 1;
|
| var west = distances[i][j - 1] + 1;
|
| distances[i][j] = north < west ? north : west;
|
| @@ -125,7 +131,7 @@ distances[i][j] = north < west ? north : west;
|
| }
|
| return distances;
|
| },
|
| -spliceOperationsFromEditDistances: function(distances) {
|
| +spliceOperationsFromEditDistances: function (distances) {
|
| var i = distances.length - 1;
|
| var j = distances[0].length - 1;
|
| var current = distances[i][j];
|
| @@ -145,7 +151,10 @@ var northWest = distances[i - 1][j - 1];
|
| var west = distances[i - 1][j];
|
| var north = distances[i][j - 1];
|
| var min;
|
| -if (west < north) min = west < northWest ? west : northWest; else min = north < northWest ? north : northWest;
|
| +if (west < north)
|
| +min = west < northWest ? west : northWest;
|
| +else
|
| +min = north < northWest ? north : northWest;
|
| if (min == northWest) {
|
| if (northWest == current) {
|
| edits.push(EDIT_LEAVE);
|
| @@ -168,22 +177,27 @@ current = north;
|
| edits.reverse();
|
| return edits;
|
| },
|
| -calcSplices: function(current, currentStart, currentEnd, old, oldStart, oldEnd) {
|
| +calcSplices: function (current, currentStart, currentEnd, old, oldStart, oldEnd) {
|
| var prefixCount = 0;
|
| var suffixCount = 0;
|
| var minLength = Math.min(currentEnd - currentStart, oldEnd - oldStart);
|
| -if (currentStart == 0 && oldStart == 0) prefixCount = this.sharedPrefix(current, old, minLength);
|
| -if (currentEnd == current.length && oldEnd == old.length) suffixCount = this.sharedSuffix(current, old, minLength - prefixCount);
|
| +if (currentStart == 0 && oldStart == 0)
|
| +prefixCount = this.sharedPrefix(current, old, minLength);
|
| +if (currentEnd == current.length && oldEnd == old.length)
|
| +suffixCount = this.sharedSuffix(current, old, minLength - prefixCount);
|
| currentStart += prefixCount;
|
| oldStart += prefixCount;
|
| currentEnd -= suffixCount;
|
| oldEnd -= suffixCount;
|
| -if (currentEnd - currentStart == 0 && oldEnd - oldStart == 0) return [];
|
| +if (currentEnd - currentStart == 0 && oldEnd - oldStart == 0)
|
| +return [];
|
| if (currentStart == currentEnd) {
|
| var splice = newSplice(currentStart, [], 0);
|
| -while (oldStart < oldEnd) splice.removed.push(old[oldStart++]);
|
| -return [ splice ];
|
| -} else if (oldStart == oldEnd) return [ newSplice(currentStart, [], currentEnd - currentStart) ];
|
| +while (oldStart < oldEnd)
|
| +splice.removed.push(old[oldStart++]);
|
| +return [splice];
|
| +} else if (oldStart == oldEnd)
|
| +return [newSplice(currentStart, [], currentEnd - currentStart)];
|
| var ops = this.spliceOperationsFromEditDistances(this.calcEditDistances(current, currentStart, currentEnd, old, oldStart, oldEnd));
|
| var splice = undefined;
|
| var splices = [];
|
| @@ -199,23 +213,23 @@ splice = undefined;
|
| index++;
|
| oldIndex++;
|
| break;
|
| -
|
| case EDIT_UPDATE:
|
| -if (!splice) splice = newSplice(index, [], 0);
|
| +if (!splice)
|
| +splice = newSplice(index, [], 0);
|
| splice.addedCount++;
|
| index++;
|
| splice.removed.push(old[oldIndex]);
|
| oldIndex++;
|
| break;
|
| -
|
| case EDIT_ADD:
|
| -if (!splice) splice = newSplice(index, [], 0);
|
| +if (!splice)
|
| +splice = newSplice(index, [], 0);
|
| splice.addedCount++;
|
| index++;
|
| break;
|
| -
|
| case EDIT_DELETE:
|
| -if (!splice) splice = newSplice(index, [], 0);
|
| +if (!splice)
|
| +splice = newSplice(index, [], 0);
|
| splice.removed.push(old[oldIndex]);
|
| oldIndex++;
|
| break;
|
| @@ -226,30 +240,32 @@ splices.push(splice);
|
| }
|
| return splices;
|
| },
|
| -sharedPrefix: function(current, old, searchLength) {
|
| -for (var i = 0; i < searchLength; i++) if (!this.equals(current[i], old[i])) return i;
|
| +sharedPrefix: function (current, old, searchLength) {
|
| +for (var i = 0; i < searchLength; i++)
|
| +if (!this.equals(current[i], old[i]))
|
| +return i;
|
| return searchLength;
|
| },
|
| -sharedSuffix: function(current, old, searchLength) {
|
| +sharedSuffix: function (current, old, searchLength) {
|
| var index1 = current.length;
|
| var index2 = old.length;
|
| var count = 0;
|
| -while (count < searchLength && this.equals(current[--index1], old[--index2])) count++;
|
| +while (count < searchLength && this.equals(current[--index1], old[--index2]))
|
| +count++;
|
| return count;
|
| },
|
| -calculateSplices: function(current, previous) {
|
| +calculateSplices: function (current, previous) {
|
| return this.calcSplices(current, 0, current.length, previous, 0, previous.length);
|
| },
|
| -equals: function(currentValue, previousValue) {
|
| +equals: function (currentValue, previousValue) {
|
| return currentValue === previousValue;
|
| }
|
| };
|
| return new ArraySplice();
|
| }();
|
| -
|
| -Polymer.EventApi = function() {
|
| +Polymer.EventApi = function () {
|
| var Settings = Polymer.Settings;
|
| -var EventApi = function(event) {
|
| +var EventApi = function (event) {
|
| this.event = event;
|
| };
|
| if (Settings.useShadow) {
|
| @@ -294,36 +310,29 @@ return this.event._path;
|
| }
|
| };
|
| }
|
| -var factory = function(event) {
|
| +var factory = function (event) {
|
| if (!event.__eventApi) {
|
| event.__eventApi = new EventApi(event);
|
| }
|
| return event.__eventApi;
|
| };
|
| -return {
|
| -factory: factory
|
| -};
|
| +return { factory: factory };
|
| }();
|
| -
|
| -Polymer.domInnerHTML = function() {
|
| +Polymer.domInnerHTML = function () {
|
| var escapeAttrRegExp = /[&\u00A0"]/g;
|
| var escapeDataRegExp = /[&\u00A0<>]/g;
|
| function escapeReplace(c) {
|
| switch (c) {
|
| -case "&":
|
| -return "&";
|
| -
|
| -case "<":
|
| -return "<";
|
| -
|
| -case ">":
|
| -return ">";
|
| -
|
| +case '&':
|
| +return '&';
|
| +case '<':
|
| +return '<';
|
| +case '>':
|
| +return '>';
|
| case '"':
|
| -return """;
|
| -
|
| -case "\u00A0":
|
| -return " ";
|
| +return '"';
|
| +case '\xA0':
|
| +return ' ';
|
| }
|
| }
|
| function escapeAttr(s) {
|
| @@ -339,41 +348,65 @@ set[arr[i]] = true;
|
| }
|
| return set;
|
| }
|
| -var voidElements = makeSet([ "area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr" ]);
|
| -var plaintextParents = makeSet([ "style", "script", "xmp", "iframe", "noembed", "noframes", "plaintext", "noscript" ]);
|
| +var voidElements = makeSet([
|
| +'area',
|
| +'base',
|
| +'br',
|
| +'col',
|
| +'command',
|
| +'embed',
|
| +'hr',
|
| +'img',
|
| +'input',
|
| +'keygen',
|
| +'link',
|
| +'meta',
|
| +'param',
|
| +'source',
|
| +'track',
|
| +'wbr'
|
| +]);
|
| +var plaintextParents = makeSet([
|
| +'style',
|
| +'script',
|
| +'xmp',
|
| +'iframe',
|
| +'noembed',
|
| +'noframes',
|
| +'plaintext',
|
| +'noscript'
|
| +]);
|
| function getOuterHTML(node, parentNode, composed) {
|
| switch (node.nodeType) {
|
| case Node.ELEMENT_NODE:
|
| var tagName = node.localName;
|
| -var s = "<" + tagName;
|
| +var s = '<' + tagName;
|
| var attrs = node.attributes;
|
| for (var i = 0, attr; attr = attrs[i]; i++) {
|
| -s += " " + attr.name + '="' + escapeAttr(attr.value) + '"';
|
| +s += ' ' + attr.name + '="' + escapeAttr(attr.value) + '"';
|
| }
|
| -s += ">";
|
| +s += '>';
|
| if (voidElements[tagName]) {
|
| return s;
|
| }
|
| -return s + getInnerHTML(node, composed) + "</" + tagName + ">";
|
| -
|
| +return s + getInnerHTML(node, composed) + '</' + tagName + '>';
|
| case Node.TEXT_NODE:
|
| var data = node.data;
|
| if (parentNode && plaintextParents[parentNode.localName]) {
|
| return data;
|
| }
|
| return escapeData(data);
|
| -
|
| case Node.COMMENT_NODE:
|
| -return "<!--" + node.data + "-->";
|
| -
|
| +return '<!--' + node.data + '-->';
|
| default:
|
| console.error(node);
|
| -throw new Error("not implemented");
|
| +throw new Error('not implemented');
|
| }
|
| }
|
| function getInnerHTML(node, composed) {
|
| -if (node instanceof HTMLTemplateElement) node = node.content;
|
| -var s = "";
|
| +if (node instanceof HTMLTemplateElement)
|
| +node = node.content;
|
| +var s = '';
|
| var c$ = Polymer.dom(node).childNodes;
|
| c$ = composed ? node._composedChildren : c$;
|
| for (var i = 0, l = c$.length, child; i < l && (child = c$[i]); i++) {
|
| @@ -381,41 +414,38 @@ s += getOuterHTML(child, node, composed);
|
| }
|
| return s;
|
| }
|
| -return {
|
| -getInnerHTML: getInnerHTML
|
| -};
|
| +return { getInnerHTML: getInnerHTML };
|
| }();
|
| -
|
| -Polymer.DomApi = function() {
|
| -"use strict";
|
| +Polymer.DomApi = function () {
|
| +'use strict';
|
| var Settings = Polymer.Settings;
|
| var getInnerHTML = Polymer.domInnerHTML.getInnerHTML;
|
| var nativeInsertBefore = Element.prototype.insertBefore;
|
| var nativeRemoveChild = Element.prototype.removeChild;
|
| var nativeAppendChild = Element.prototype.appendChild;
|
| var dirtyRoots = [];
|
| -var DomApi = function(node) {
|
| +var DomApi = function (node) {
|
| this.node = node;
|
| if (this.patch) {
|
| this.patch();
|
| }
|
| };
|
| DomApi.prototype = {
|
| -flush: function() {
|
| +flush: function () {
|
| for (var i = 0, host; i < dirtyRoots.length; i++) {
|
| host = dirtyRoots[i];
|
| -host.flushDebouncer("_distribute");
|
| +host.flushDebouncer('_distribute');
|
| }
|
| dirtyRoots = [];
|
| },
|
| -_lazyDistribute: function(host) {
|
| +_lazyDistribute: function (host) {
|
| if (host.shadyRoot && host.shadyRoot._distributionClean) {
|
| host.shadyRoot._distributionClean = false;
|
| -host.debounce("_distribute", host._distributeContent);
|
| +host.debounce('_distribute', host._distributeContent);
|
| dirtyRoots.push(host);
|
| }
|
| },
|
| -appendChild: function(node) {
|
| +appendChild: function (node) {
|
| var distributed;
|
| this._removeNodeFromHost(node);
|
| if (this._nodeIsInLogicalTree(this.node)) {
|
| @@ -433,7 +463,7 @@ addToComposedParent(container, node);
|
| }
|
| return node;
|
| },
|
| -insertBefore: function(node, ref_node) {
|
| +insertBefore: function (node, ref_node) {
|
| if (!ref_node) {
|
| return this.appendChild(node);
|
| }
|
| @@ -444,7 +474,7 @@ saveLightChildrenIfNeeded(this.node);
|
| var children = this.childNodes;
|
| var index = children.indexOf(ref_node);
|
| if (index < 0) {
|
| -throw Error("The ref_node to be inserted before is not a child " + "of this node");
|
| +throw Error('The ref_node to be inserted before is not a child ' + 'of this node');
|
| }
|
| var host = this._hostForNode(this.node);
|
| this._addLogicalInfo(node, this.node, host && host.shadyRoot, index);
|
| @@ -461,9 +491,9 @@ addToComposedParent(container, node, ref_node);
|
| }
|
| return node;
|
| },
|
| -removeChild: function(node) {
|
| +removeChild: function (node) {
|
| if (factory(node).parentNode !== this.node) {
|
| -console.warn("The node to be removed is not a child of this node", node);
|
| +console.warn('The node to be removed is not a child of this node', node);
|
| }
|
| var distributed;
|
| if (this._nodeIsInLogicalTree(this.node)) {
|
| @@ -480,15 +510,15 @@ removeFromComposedParent(container, node);
|
| }
|
| return node;
|
| },
|
| -replaceChild: function(node, ref_node) {
|
| +replaceChild: function (node, ref_node) {
|
| this.insertBefore(node, ref_node);
|
| this.removeChild(ref_node);
|
| return node;
|
| },
|
| -getOwnerRoot: function() {
|
| +getOwnerRoot: function () {
|
| return this._ownerShadyRootForNode(this.node);
|
| },
|
| -_ownerShadyRootForNode: function(node) {
|
| +_ownerShadyRootForNode: function (node) {
|
| if (!node) {
|
| return;
|
| }
|
| @@ -508,7 +538,7 @@ node._ownerShadyRoot = root;
|
| }
|
| return node._ownerShadyRoot;
|
| },
|
| -_maybeDistribute: function(node, parent, host) {
|
| +_maybeDistribute: function (node, parent, host) {
|
| var nodeNeedsDistribute = this._nodeNeedsDistribution(node);
|
| var distribute = this._parentNeedsDistribution(parent) || nodeNeedsDistribute;
|
| if (nodeNeedsDistribute) {
|
| @@ -519,7 +549,7 @@ this._lazyDistribute(host);
|
| }
|
| return distribute;
|
| },
|
| -_tryRemoveUndistributedNode: function(node) {
|
| +_tryRemoveUndistributedNode: function (node) {
|
| if (this.node.shadyRoot) {
|
| if (node.parentNode) {
|
| nativeRemoveChild.call(node.parentNode, node);
|
| @@ -527,23 +557,23 @@ nativeRemoveChild.call(node.parentNode, node);
|
| return true;
|
| }
|
| },
|
| -_updateInsertionPoints: function(host) {
|
| +_updateInsertionPoints: function (host) {
|
| host.shadyRoot._insertionPoints = factory(host.shadyRoot).querySelectorAll(CONTENT);
|
| },
|
| -_nodeIsInLogicalTree: function(node) {
|
| +_nodeIsInLogicalTree: function (node) {
|
| return Boolean(node._lightParent || node._isShadyRoot || this._ownerShadyRootForNode(node) || node.shadyRoot);
|
| },
|
| -_hostForNode: function(node) {
|
| +_hostForNode: function (node) {
|
| var root = node.shadyRoot || (node._isShadyRoot ? node : this._ownerShadyRootForNode(node));
|
| return root && root.host;
|
| },
|
| -_parentNeedsDistribution: function(parent) {
|
| +_parentNeedsDistribution: function (parent) {
|
| return parent && parent.shadyRoot && hasInsertionPoint(parent.shadyRoot);
|
| },
|
| -_nodeNeedsDistribution: function(node) {
|
| +_nodeNeedsDistribution: function (node) {
|
| return node.localName === CONTENT || node.nodeType === Node.DOCUMENT_FRAGMENT_NODE && node.querySelector(CONTENT);
|
| },
|
| -_removeNodeFromHost: function(node) {
|
| +_removeNodeFromHost: function (node) {
|
| if (node._lightParent) {
|
| var root = this._ownerShadyRootForNode(node);
|
| if (root) {
|
| @@ -553,14 +583,14 @@ this._removeLogicalInfo(node, node._lightParent);
|
| }
|
| this._removeOwnerShadyRoot(node);
|
| },
|
| -_addNodeToHost: function(node) {
|
| +_addNodeToHost: function (node) {
|
| var checkNode = node.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? node.firstChild : node;
|
| var root = this._ownerShadyRootForNode(checkNode);
|
| if (root) {
|
| root.host._elementAdd(node);
|
| }
|
| },
|
| -_addLogicalInfo: function(node, container, root, index) {
|
| +_addLogicalInfo: function (node, container, root, index) {
|
| saveLightChildrenIfNeeded(container);
|
| var children = factory(container).childNodes;
|
| index = index === undefined ? children.length : index;
|
| @@ -575,16 +605,16 @@ children.splice(index, 0, node);
|
| node._lightParent = container;
|
| }
|
| },
|
| -_removeLogicalInfo: function(node, container) {
|
| +_removeLogicalInfo: function (node, container) {
|
| var children = factory(container).childNodes;
|
| var index = children.indexOf(node);
|
| if (index < 0 || container !== node._lightParent) {
|
| -throw Error("The node to be removed is not a child of this node");
|
| +throw Error('The node to be removed is not a child of this node');
|
| }
|
| children.splice(index, 1);
|
| node._lightParent = null;
|
| },
|
| -_removeOwnerShadyRoot: function(node) {
|
| +_removeOwnerShadyRoot: function (node) {
|
| var hasCachedRoot = factory(node).getOwnerRoot() !== undefined;
|
| if (hasCachedRoot) {
|
| var c$ = factory(node).childNodes;
|
| @@ -594,7 +624,7 @@ this._removeOwnerShadyRoot(n);
|
| }
|
| node._ownerShadyRoot = undefined;
|
| },
|
| -_firstComposedNode: function(content) {
|
| +_firstComposedNode: function (content) {
|
| var n$ = factory(content).getDistributedNodes();
|
| for (var i = 0, l = n$.length, n, p$; i < l && (n = n$[i]); i++) {
|
| p$ = factory(n).getDestinationInsertionPoints();
|
| @@ -603,40 +633,40 @@ return n;
|
| }
|
| }
|
| },
|
| -querySelector: function(selector) {
|
| +querySelector: function (selector) {
|
| return this.querySelectorAll(selector)[0];
|
| },
|
| -querySelectorAll: function(selector) {
|
| -return this._query(function(n) {
|
| +querySelectorAll: function (selector) {
|
| +return this._query(function (n) {
|
| return matchesSelector.call(n, selector);
|
| }, this.node);
|
| },
|
| -_query: function(matcher, node) {
|
| +_query: function (matcher, node) {
|
| node = node || this.node;
|
| var list = [];
|
| this._queryElements(factory(node).childNodes, matcher, list);
|
| return list;
|
| },
|
| -_queryElements: function(elements, matcher, list) {
|
| +_queryElements: function (elements, matcher, list) {
|
| for (var i = 0, l = elements.length, c; i < l && (c = elements[i]); i++) {
|
| if (c.nodeType === Node.ELEMENT_NODE) {
|
| this._queryElement(c, matcher, list);
|
| }
|
| }
|
| },
|
| -_queryElement: function(node, matcher, list) {
|
| +_queryElement: function (node, matcher, list) {
|
| if (matcher(node)) {
|
| list.push(node);
|
| }
|
| this._queryElements(factory(node).childNodes, matcher, list);
|
| },
|
| -getDestinationInsertionPoints: function() {
|
| +getDestinationInsertionPoints: function () {
|
| return this.node._destinationInsertionPoints || [];
|
| },
|
| -getDistributedNodes: function() {
|
| +getDistributedNodes: function () {
|
| return this.node._distributedNodes || [];
|
| },
|
| -queryDistributedElements: function(selector) {
|
| +queryDistributedElements: function (selector) {
|
| var c$ = this.childNodes;
|
| var list = [];
|
| this._distributedFilter(selector, c$, list);
|
| @@ -647,7 +677,7 @@ this._distributedFilter(selector, factory(c).getDistributedNodes(), list);
|
| }
|
| return list;
|
| },
|
| -_distributedFilter: function(selector, list, results) {
|
| +_distributedFilter: function (selector, list, results) {
|
| results = results || [];
|
| for (var i = 0, l = list.length, d; i < l && (d = list[i]); i++) {
|
| if (d.nodeType === Node.ELEMENT_NODE && d.localName !== CONTENT && matchesSelector.call(d, selector)) {
|
| @@ -656,27 +686,27 @@ results.push(d);
|
| }
|
| return results;
|
| },
|
| -_clear: function() {
|
| +_clear: function () {
|
| while (this.childNodes.length) {
|
| this.removeChild(this.childNodes[0]);
|
| }
|
| },
|
| -setAttribute: function(name, value) {
|
| +setAttribute: function (name, value) {
|
| this.node.setAttribute(name, value);
|
| this._distributeParent();
|
| },
|
| -removeAttribute: function(name) {
|
| +removeAttribute: function (name) {
|
| this.node.removeAttribute(name);
|
| this._distributeParent();
|
| },
|
| -_distributeParent: function() {
|
| +_distributeParent: function () {
|
| if (this._parentNeedsDistribution(this.parentNode)) {
|
| this._lazyDistribute(this.parentNode);
|
| }
|
| }
|
| };
|
| -Object.defineProperty(DomApi.prototype, "classList", {
|
| -get: function() {
|
| +Object.defineProperty(DomApi.prototype, 'classList', {
|
| +get: function () {
|
| if (!this._classList) {
|
| this._classList = new DomApi.ClassList(this);
|
| }
|
| @@ -684,20 +714,20 @@ return this._classList;
|
| },
|
| configurable: true
|
| });
|
| -DomApi.ClassList = function(host) {
|
| +DomApi.ClassList = function (host) {
|
| this.domApi = host;
|
| this.node = host.node;
|
| };
|
| DomApi.ClassList.prototype = {
|
| -add: function() {
|
| +add: function () {
|
| this.node.classList.add.apply(this.node.classList, arguments);
|
| this.domApi._distributeParent();
|
| },
|
| -remove: function() {
|
| +remove: function () {
|
| this.node.classList.remove.apply(this.node.classList, arguments);
|
| this.domApi._distributeParent();
|
| },
|
| -toggle: function() {
|
| +toggle: function () {
|
| this.node.classList.toggle.apply(this.node.classList, arguments);
|
| this.domApi._distributeParent();
|
| }
|
| @@ -705,41 +735,41 @@ this.domApi._distributeParent();
|
| if (!Settings.useShadow) {
|
| Object.defineProperties(DomApi.prototype, {
|
| childNodes: {
|
| -get: function() {
|
| +get: function () {
|
| var c$ = getLightChildren(this.node);
|
| return Array.isArray(c$) ? c$ : Array.prototype.slice.call(c$);
|
| },
|
| configurable: true
|
| },
|
| children: {
|
| -get: function() {
|
| -return Array.prototype.filter.call(this.childNodes, function(n) {
|
| +get: function () {
|
| +return Array.prototype.filter.call(this.childNodes, function (n) {
|
| return n.nodeType === Node.ELEMENT_NODE;
|
| });
|
| },
|
| configurable: true
|
| },
|
| parentNode: {
|
| -get: function() {
|
| +get: function () {
|
| return this.node._lightParent || (this.node.__patched ? this.node._composedParent : this.node.parentNode);
|
| },
|
| configurable: true
|
| },
|
| firstChild: {
|
| -get: function() {
|
| +get: function () {
|
| return this.childNodes[0];
|
| },
|
| configurable: true
|
| },
|
| lastChild: {
|
| -get: function() {
|
| +get: function () {
|
| var c$ = this.childNodes;
|
| return c$[c$.length - 1];
|
| },
|
| configurable: true
|
| },
|
| nextSibling: {
|
| -get: function() {
|
| +get: function () {
|
| var c$ = this.parentNode && factory(this.parentNode).childNodes;
|
| if (c$) {
|
| return c$[Array.prototype.indexOf.call(c$, this.node) + 1];
|
| @@ -748,7 +778,7 @@ return c$[Array.prototype.indexOf.call(c$, this.node) + 1];
|
| configurable: true
|
| },
|
| previousSibling: {
|
| -get: function() {
|
| +get: function () {
|
| var c$ = this.parentNode && factory(this.parentNode).childNodes;
|
| if (c$) {
|
| return c$[Array.prototype.indexOf.call(c$, this.node) - 1];
|
| @@ -757,20 +787,20 @@ return c$[Array.prototype.indexOf.call(c$, this.node) - 1];
|
| configurable: true
|
| },
|
| firstElementChild: {
|
| -get: function() {
|
| +get: function () {
|
| return this.children[0];
|
| },
|
| configurable: true
|
| },
|
| lastElementChild: {
|
| -get: function() {
|
| +get: function () {
|
| var c$ = this.children;
|
| return c$[c$.length - 1];
|
| },
|
| configurable: true
|
| },
|
| nextElementSibling: {
|
| -get: function() {
|
| +get: function () {
|
| var c$ = this.parentNode && factory(this.parentNode).children;
|
| if (c$) {
|
| return c$[Array.prototype.indexOf.call(c$, this.node) + 1];
|
| @@ -779,7 +809,7 @@ return c$[Array.prototype.indexOf.call(c$, this.node) + 1];
|
| configurable: true
|
| },
|
| previousElementSibling: {
|
| -get: function() {
|
| +get: function () {
|
| var c$ = this.parentNode && factory(this.parentNode).children;
|
| if (c$) {
|
| return c$[Array.prototype.indexOf.call(c$, this.node) - 1];
|
| @@ -788,16 +818,16 @@ return c$[Array.prototype.indexOf.call(c$, this.node) - 1];
|
| configurable: true
|
| },
|
| textContent: {
|
| -get: function() {
|
| +get: function () {
|
| if (this.node.nodeType === Node.TEXT_NODE) {
|
| return this.node.textContent;
|
| } else {
|
| -return Array.prototype.map.call(this.childNodes, function(c) {
|
| +return Array.prototype.map.call(this.childNodes, function (c) {
|
| return c.textContent;
|
| -}).join("");
|
| +}).join('');
|
| }
|
| },
|
| -set: function(text) {
|
| +set: function (text) {
|
| this._clear();
|
| if (text) {
|
| this.appendChild(document.createTextNode(text));
|
| @@ -806,17 +836,17 @@ this.appendChild(document.createTextNode(text));
|
| configurable: true
|
| },
|
| innerHTML: {
|
| -get: function() {
|
| +get: function () {
|
| if (this.node.nodeType === Node.TEXT_NODE) {
|
| return null;
|
| } else {
|
| return getInnerHTML(this.node);
|
| }
|
| },
|
| -set: function(text) {
|
| +set: function (text) {
|
| if (this.node.nodeType !== Node.TEXT_NODE) {
|
| this._clear();
|
| -var d = document.createElement("div");
|
| +var d = document.createElement('div');
|
| d.innerHTML = text;
|
| for (var e = d.firstChild; e; e = e.nextSibling) {
|
| this.appendChild(e);
|
| @@ -826,14 +856,14 @@ this.appendChild(e);
|
| configurable: true
|
| }
|
| });
|
| -DomApi.prototype._getComposedInnerHTML = function() {
|
| +DomApi.prototype._getComposedInnerHTML = function () {
|
| return getInnerHTML(this.node, true);
|
| };
|
| } else {
|
| -DomApi.prototype.querySelectorAll = function(selector) {
|
| +DomApi.prototype.querySelectorAll = function (selector) {
|
| return Array.prototype.slice.call(this.node.querySelectorAll(selector));
|
| };
|
| -DomApi.prototype.getOwnerRoot = function() {
|
| +DomApi.prototype.getOwnerRoot = function () {
|
| var n = this.node;
|
| while (n) {
|
| if (n.nodeType === Node.DOCUMENT_FRAGMENT_NODE && n.host) {
|
| @@ -842,66 +872,77 @@ return n;
|
| n = n.parentNode;
|
| }
|
| };
|
| -DomApi.prototype.getDestinationInsertionPoints = function() {
|
| +DomApi.prototype.getDestinationInsertionPoints = function () {
|
| var n$ = this.node.getDestinationInsertionPoints();
|
| return n$ ? Array.prototype.slice.call(n$) : [];
|
| };
|
| -DomApi.prototype.getDistributedNodes = function() {
|
| +DomApi.prototype.getDistributedNodes = function () {
|
| var n$ = this.node.getDistributedNodes();
|
| return n$ ? Array.prototype.slice.call(n$) : [];
|
| };
|
| -DomApi.prototype._distributeParent = function() {};
|
| +DomApi.prototype._distributeParent = function () {
|
| +};
|
| Object.defineProperties(DomApi.prototype, {
|
| childNodes: {
|
| -get: function() {
|
| +get: function () {
|
| return Array.prototype.slice.call(this.node.childNodes);
|
| },
|
| configurable: true
|
| },
|
| children: {
|
| -get: function() {
|
| +get: function () {
|
| return Array.prototype.slice.call(this.node.children);
|
| },
|
| configurable: true
|
| },
|
| textContent: {
|
| -get: function() {
|
| +get: function () {
|
| return this.node.textContent;
|
| },
|
| -set: function(value) {
|
| +set: function (value) {
|
| return this.node.textContent = value;
|
| },
|
| configurable: true
|
| },
|
| innerHTML: {
|
| -get: function() {
|
| +get: function () {
|
| return this.node.innerHTML;
|
| },
|
| -set: function(value) {
|
| +set: function (value) {
|
| return this.node.innerHTML = value;
|
| },
|
| configurable: true
|
| }
|
| });
|
| -var forwards = [ "parentNode", "firstChild", "lastChild", "nextSibling", "previousSibling", "firstElementChild", "lastElementChild", "nextElementSibling", "previousElementSibling" ];
|
| -forwards.forEach(function(name) {
|
| +var forwards = [
|
| +'parentNode',
|
| +'firstChild',
|
| +'lastChild',
|
| +'nextSibling',
|
| +'previousSibling',
|
| +'firstElementChild',
|
| +'lastElementChild',
|
| +'nextElementSibling',
|
| +'previousElementSibling'
|
| +];
|
| +forwards.forEach(function (name) {
|
| Object.defineProperty(DomApi.prototype, name, {
|
| -get: function() {
|
| +get: function () {
|
| return this.node[name];
|
| },
|
| configurable: true
|
| });
|
| });
|
| }
|
| -var CONTENT = "content";
|
| -var factory = function(node, patch) {
|
| +var CONTENT = 'content';
|
| +var factory = function (node, patch) {
|
| node = node || document;
|
| if (!node.__domApi) {
|
| node.__domApi = new DomApi(node, patch);
|
| }
|
| return node.__domApi;
|
| };
|
| -Polymer.dom = function(obj, patch) {
|
| +Polymer.dom = function (obj, patch) {
|
| if (obj instanceof Event) {
|
| return Polymer.EventApi.factory(obj);
|
| } else {
|
| @@ -924,7 +965,7 @@ var children = getComposedChildren(parent);
|
| var i = ref_node ? children.indexOf(ref_node) : -1;
|
| if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
|
| var fragChildren = getComposedChildren(node);
|
| -fragChildren.forEach(function(c) {
|
| +fragChildren.forEach(function (c) {
|
| addNodeToComposedChildren(c, parent, children, i);
|
| });
|
| } else {
|
| @@ -974,21 +1015,20 @@ ctor: DomApi,
|
| factory: factory
|
| };
|
| }();
|
| -
|
| -(function() {
|
| +(function () {
|
| Polymer.Base._addFeature({
|
| -_prepShady: function() {
|
| +_prepShady: function () {
|
| this._useContent = this._useContent || Boolean(this._template);
|
| if (this._useContent) {
|
| -this._template._hasInsertionPoint = this._template.content.querySelector("content");
|
| +this._template._hasInsertionPoint = this._template.content.querySelector('content');
|
| }
|
| },
|
| -_poolContent: function() {
|
| +_poolContent: function () {
|
| if (this._useContent) {
|
| saveLightChildrenIfNeeded(this);
|
| }
|
| },
|
| -_setupRoot: function() {
|
| +_setupRoot: function () {
|
| if (this._useContent) {
|
| this._createLocalRoot();
|
| if (!this.dataHost) {
|
| @@ -996,12 +1036,12 @@ upgradeLightChildren(this._lightChildren);
|
| }
|
| }
|
| },
|
| -_createLocalRoot: function() {
|
| +_createLocalRoot: function () {
|
| this.shadyRoot = this.root;
|
| this.shadyRoot._distributionClean = false;
|
| this.shadyRoot._isShadyRoot = true;
|
| this.shadyRoot._dirtyRoots = [];
|
| -this.shadyRoot._insertionPoints = this._template._hasInsertionPoint ? this.shadyRoot.querySelectorAll("content") : [];
|
| +this.shadyRoot._insertionPoints = this._template._hasInsertionPoint ? this.shadyRoot.querySelectorAll('content') : [];
|
| saveLightChildrenIfNeeded(this.shadyRoot);
|
| this.shadyRoot.host = this;
|
| },
|
| @@ -1009,39 +1049,39 @@ get domHost() {
|
| var root = Polymer.dom(this).getOwnerRoot();
|
| return root && root.host;
|
| },
|
| -distributeContent: function() {
|
| +distributeContent: function () {
|
| if (this.shadyRoot) {
|
| var host = getTopDistributingHost(this);
|
| Polymer.dom(this)._lazyDistribute(host);
|
| }
|
| },
|
| -_distributeContent: function() {
|
| +_distributeContent: function () {
|
| if (this._useContent && !this.shadyRoot._distributionClean) {
|
| this._beginDistribute();
|
| this._distributeDirtyRoots();
|
| this._finishDistribute();
|
| }
|
| },
|
| -_beginDistribute: function() {
|
| +_beginDistribute: function () {
|
| if (this._useContent && hasInsertionPoint(this.shadyRoot)) {
|
| this._resetDistribution();
|
| this._distributePool(this.shadyRoot, this._collectPool());
|
| }
|
| },
|
| -_distributeDirtyRoots: function() {
|
| +_distributeDirtyRoots: function () {
|
| var c$ = this.shadyRoot._dirtyRoots;
|
| for (var i = 0, l = c$.length, c; i < l && (c = c$[i]); i++) {
|
| c._distributeContent();
|
| }
|
| this.shadyRoot._dirtyRoots = [];
|
| },
|
| -_finishDistribute: function() {
|
| +_finishDistribute: function () {
|
| if (this._useContent) {
|
| if (hasInsertionPoint(this.shadyRoot)) {
|
| this._composeTree();
|
| } else {
|
| if (!this.shadyRoot._hasDistributed) {
|
| -this.textContent = "";
|
| +this.textContent = '';
|
| this.appendChild(this.shadyRoot);
|
| } else {
|
| var children = this._composeNode(this);
|
| @@ -1052,11 +1092,11 @@ this.shadyRoot._hasDistributed = true;
|
| this.shadyRoot._distributionClean = true;
|
| }
|
| },
|
| -elementMatches: function(selector, node) {
|
| +elementMatches: function (selector, node) {
|
| node = node || this;
|
| return matchesSelector.call(node, selector);
|
| },
|
| -_resetDistribution: function() {
|
| +_resetDistribution: function () {
|
| var children = getLightChildren(this);
|
| for (var i = 0; i < children.length; i++) {
|
| var child = children[i];
|
| @@ -1073,7 +1113,7 @@ for (var j = 0; j < p$.length; j++) {
|
| p$[j]._distributedNodes = [];
|
| }
|
| },
|
| -_collectPool: function() {
|
| +_collectPool: function () {
|
| var pool = [];
|
| var children = getLightChildren(this);
|
| for (var i = 0; i < children.length; i++) {
|
| @@ -1086,14 +1126,14 @@ pool.push(child);
|
| }
|
| return pool;
|
| },
|
| -_distributePool: function(node, pool) {
|
| +_distributePool: function (node, pool) {
|
| var p$ = node._insertionPoints;
|
| for (var i = 0, l = p$.length, p; i < l && (p = p$[i]); i++) {
|
| this._distributeInsertionPoint(p, pool);
|
| maybeRedistributeParent(p, this);
|
| }
|
| },
|
| -_distributeInsertionPoint: function(content, pool) {
|
| +_distributeInsertionPoint: function (content, pool) {
|
| var anyDistributed = false;
|
| for (var i = 0, l = pool.length, node; i < l; i++) {
|
| node = pool[i];
|
| @@ -1113,7 +1153,7 @@ distributeNodeInto(children[j], content);
|
| }
|
| }
|
| },
|
| -_composeTree: function() {
|
| +_composeTree: function () {
|
| this._updateChildNodes(this, this._composeNode(this));
|
| var p$ = this.shadyRoot._insertionPoints;
|
| for (var i = 0, l = p$.length, p, parent; i < l && (p = p$[i]); i++) {
|
| @@ -1123,7 +1163,7 @@ this._updateChildNodes(parent, this._composeNode(parent));
|
| }
|
| }
|
| },
|
| -_composeNode: function(node) {
|
| +_composeNode: function (node) {
|
| var children = [];
|
| var c$ = getLightChildren(node.shadyRoot || node);
|
| for (var i = 0; i < c$.length; i++) {
|
| @@ -1142,7 +1182,7 @@ children.push(child);
|
| }
|
| return children;
|
| },
|
| -_updateChildNodes: function(container, children) {
|
| +_updateChildNodes: function (container, children) {
|
| 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++) {
|
| @@ -1161,8 +1201,8 @@ composed.splice(j, 0, n);
|
| }
|
| }
|
| },
|
| -_matchesContentSelect: function(node, contentElement) {
|
| -var select = contentElement.getAttribute("select");
|
| +_matchesContentSelect: function (node, contentElement) {
|
| +var select = contentElement.getAttribute('select');
|
| if (!select) {
|
| return true;
|
| }
|
| @@ -1179,8 +1219,10 @@ return false;
|
| }
|
| return this.elementMatches(select, node);
|
| },
|
| -_elementAdd: function() {},
|
| -_elementRemove: function() {}
|
| +_elementAdd: function () {
|
| +},
|
| +_elementRemove: function () {
|
| +}
|
| });
|
| var saveLightChildrenIfNeeded = Polymer.DomApi.saveLightChildrenIfNeeded;
|
| var getLightChildren = Polymer.DomApi.getLightChildren;
|
| @@ -1192,7 +1234,7 @@ function distributeNodeInto(child, insertionPoint) {
|
| insertionPoint._distributedNodes.push(child);
|
| var points = child._destinationInsertionPoints;
|
| if (!points) {
|
| -child._destinationInsertionPoints = [ insertionPoint ];
|
| +child._destinationInsertionPoints = [insertionPoint];
|
| } else {
|
| points.push(insertionPoint);
|
| }
|
| @@ -1218,7 +1260,7 @@ var points = node._destinationInsertionPoints;
|
| return points && points[points.length - 1] === insertionPoint;
|
| }
|
| function isInsertionPoint(node) {
|
| -return node.localName == "content";
|
| +return node.localName == 'content';
|
| }
|
| var nativeInsertBefore = Element.prototype.insertBefore;
|
| var nativeRemoveChild = Element.prototype.removeChild;
|
| @@ -1253,7 +1295,7 @@ function hostNeedsRedistribution(host) {
|
| var c$ = Polymer.dom(host).children;
|
| for (var i = 0, c; i < c$.length; i++) {
|
| c = c$[i];
|
| -if (c.localName === "content") {
|
| +if (c.localName === 'content') {
|
| return host.domHost;
|
| }
|
| }
|
| @@ -1266,27 +1308,29 @@ CustomElements.upgrade(children[i]);
|
| }
|
| }
|
| }
|
| -})();
|
| -
|
| +}());
|
| if (Polymer.Settings.useShadow) {
|
| Polymer.Base._addFeature({
|
| -_poolContent: function() {},
|
| -_beginDistribute: function() {},
|
| -distributeContent: function() {},
|
| -_distributeContent: function() {},
|
| -_finishDistribute: function() {},
|
| -_createLocalRoot: function() {
|
| +_poolContent: function () {
|
| +},
|
| +_beginDistribute: function () {
|
| +},
|
| +distributeContent: function () {
|
| +},
|
| +_distributeContent: function () {
|
| +},
|
| +_finishDistribute: function () {
|
| +},
|
| +_createLocalRoot: function () {
|
| this.createShadowRoot();
|
| this.shadowRoot.appendChild(this.root);
|
| this.root = this.shadowRoot;
|
| }
|
| });
|
| }
|
| -
|
| -Polymer.DomModule = document.createElement("dom-module");
|
| -
|
| +Polymer.DomModule = document.createElement('dom-module');
|
| Polymer.Base._addFeature({
|
| -_registerFeatures: function() {
|
| +_registerFeatures: function () {
|
| this._prepIs();
|
| this._prepAttributes();
|
| this._prepBehaviors();
|
| @@ -1295,10 +1339,10 @@ this._prepConstructor();
|
| this._prepTemplate();
|
| this._prepShady();
|
| },
|
| -_prepBehavior: function(b) {
|
| +_prepBehavior: function (b) {
|
| this._addHostAttributes(b.hostAttributes);
|
| },
|
| -_initFeatures: function() {
|
| +_initFeatures: function () {
|
| this._poolContent();
|
| this._pushHost();
|
| this._stampTemplate();
|
| @@ -1308,5 +1352,6 @@ this._setupDebouncers();
|
| this._marshalBehaviors();
|
| this._tryReady();
|
| },
|
| -_marshalBehavior: function(b) {}
|
| +_marshalBehavior: function (b) {
|
| +}
|
| });
|
|
|