| Index: polymer_1.2.3/bower_components/webcomponentsjs/webcomponents.js
|
| diff --git a/polymer_1.0.4/bower_components/webcomponentsjs/webcomponents.js b/polymer_1.2.3/bower_components/webcomponentsjs/webcomponents.js
|
| similarity index 96%
|
| copy from polymer_1.0.4/bower_components/webcomponentsjs/webcomponents.js
|
| copy to polymer_1.2.3/bower_components/webcomponentsjs/webcomponents.js
|
| index 6d7154174e8cc313120fbf1edb33593e1688c775..546067f1851b02301672d3c11f1c4465577e1939 100644
|
| --- a/polymer_1.0.4/bower_components/webcomponentsjs/webcomponents.js
|
| +++ b/polymer_1.2.3/bower_components/webcomponentsjs/webcomponents.js
|
| @@ -7,13 +7,14 @@
|
| * 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
|
| -window.WebComponents = window.WebComponents || {};
|
| -
|
| -(function(scope) {
|
| - var flags = scope.flags || {};
|
| +// @version 0.7.20
|
| +(function() {
|
| + window.WebComponents = window.WebComponents || {
|
| + flags: {}
|
| + };
|
| var file = "webcomponents.js";
|
| var script = document.querySelector('script[src*="' + file + '"]');
|
| + var flags = {};
|
| if (!flags.noOpts) {
|
| location.search.slice(1).split("&").forEach(function(option) {
|
| var parts = option.split("=");
|
| @@ -51,8 +52,8 @@ window.WebComponents = window.WebComponents || {};
|
| };
|
| window.CustomElements.flags.register = flags.register;
|
| }
|
| - scope.flags = flags;
|
| -})(WebComponents);
|
| + WebComponents.flags = flags;
|
| +})();
|
|
|
| if (WebComponents.flags.shadow) {
|
| if (typeof WeakMap === "undefined") {
|
| @@ -351,6 +352,7 @@ if (WebComponents.flags.shadow) {
|
| });
|
| });
|
| }
|
| + scope.addForwardingProperties = addForwardingProperties;
|
| scope.assert = assert;
|
| scope.constructorTable = constructorTable;
|
| scope.defineGetter = defineGetter;
|
| @@ -1158,6 +1160,24 @@ if (WebComponents.flags.shadow) {
|
| stopImmediatePropagationTable.set(this, true);
|
| }
|
| };
|
| + var supportsDefaultPrevented = function() {
|
| + var e = document.createEvent("Event");
|
| + e.initEvent("test", true, true);
|
| + e.preventDefault();
|
| + return e.defaultPrevented;
|
| + }();
|
| + if (!supportsDefaultPrevented) {
|
| + Event.prototype.preventDefault = function() {
|
| + if (!this.cancelable) return;
|
| + unsafeUnwrap(this).preventDefault();
|
| + Object.defineProperty(this, "defaultPrevented", {
|
| + get: function() {
|
| + return true;
|
| + },
|
| + configurable: true
|
| + });
|
| + };
|
| + }
|
| registerWrapper(OriginalEvent, Event, document.createEvent("Event"));
|
| function unwrapOptions(options) {
|
| if (!options || !options.relatedTarget) return options;
|
| @@ -1781,8 +1801,8 @@ if (WebComponents.flags.shadow) {
|
| var originalInsertBefore = OriginalNode.prototype.insertBefore;
|
| var originalRemoveChild = OriginalNode.prototype.removeChild;
|
| var originalReplaceChild = OriginalNode.prototype.replaceChild;
|
| - var isIe = /Trident|Edge/.test(navigator.userAgent);
|
| - var removeChildOriginalHelper = isIe ? function(parent, child) {
|
| + var isIEOrEdge = /Trident|Edge/.test(navigator.userAgent);
|
| + var removeChildOriginalHelper = isIEOrEdge ? function(parent, child) {
|
| try {
|
| originalRemoveChild.call(parent, child);
|
| } catch (ex) {
|
| @@ -2752,7 +2772,7 @@ if (WebComponents.flags.shadow) {
|
| enumerable: true
|
| });
|
| }
|
| - [ "getBoundingClientRect", "getClientRects", "scrollIntoView" ].forEach(methodRequiresRendering);
|
| + [ "focus", "getBoundingClientRect", "getClientRects", "scrollIntoView" ].forEach(methodRequiresRendering);
|
| registerWrapper(OriginalHTMLElement, HTMLElement, document.createElement("b"));
|
| scope.wrappers.HTMLElement = HTMLElement;
|
| scope.getInnerHTML = getInnerHTML;
|
| @@ -3159,18 +3179,29 @@ if (WebComponents.flags.shadow) {
|
| "use strict";
|
| var Element = scope.wrappers.Element;
|
| var HTMLElement = scope.wrappers.HTMLElement;
|
| - var registerObject = scope.registerObject;
|
| + var registerWrapper = scope.registerWrapper;
|
| var defineWrapGetter = scope.defineWrapGetter;
|
| + var unsafeUnwrap = scope.unsafeUnwrap;
|
| + var wrap = scope.wrap;
|
| + var mixin = scope.mixin;
|
| var SVG_NS = "http://www.w3.org/2000/svg";
|
| + var OriginalSVGElement = window.SVGElement;
|
| var svgTitleElement = document.createElementNS(SVG_NS, "title");
|
| - var SVGTitleElement = registerObject(svgTitleElement);
|
| - var SVGElement = Object.getPrototypeOf(SVGTitleElement.prototype).constructor;
|
| if (!("classList" in svgTitleElement)) {
|
| var descr = Object.getOwnPropertyDescriptor(Element.prototype, "classList");
|
| Object.defineProperty(HTMLElement.prototype, "classList", descr);
|
| delete Element.prototype.classList;
|
| }
|
| - defineWrapGetter(SVGElement, "ownerSVGElement");
|
| + function SVGElement(node) {
|
| + Element.call(this, node);
|
| + }
|
| + SVGElement.prototype = Object.create(Element.prototype);
|
| + mixin(SVGElement.prototype, {
|
| + get ownerSVGElement() {
|
| + return wrap(unsafeUnwrap(this).ownerSVGElement);
|
| + }
|
| + });
|
| + registerWrapper(OriginalSVGElement, SVGElement, document.createElementNS(SVG_NS, "title"));
|
| scope.wrappers.SVGElement = SVGElement;
|
| })(window.ShadowDOMPolyfill);
|
| (function(scope) {
|
| @@ -3276,6 +3307,7 @@ if (WebComponents.flags.shadow) {
|
| })(window.ShadowDOMPolyfill);
|
| (function(scope) {
|
| "use strict";
|
| + var addForwardingProperties = scope.addForwardingProperties;
|
| var mixin = scope.mixin;
|
| var registerWrapper = scope.registerWrapper;
|
| var setWrapper = scope.setWrapper;
|
| @@ -3300,6 +3332,10 @@ if (WebComponents.flags.shadow) {
|
| unsafeUnwrap(this).texSubImage2D.apply(unsafeUnwrap(this), arguments);
|
| }
|
| });
|
| + var OriginalWebGLRenderingContextBase = Object.getPrototypeOf(OriginalWebGLRenderingContext.prototype);
|
| + if (OriginalWebGLRenderingContextBase !== Object.prototype) {
|
| + addForwardingProperties(OriginalWebGLRenderingContextBase, WebGLRenderingContext.prototype);
|
| + }
|
| var instanceProperties = /WebKit/.test(navigator.userAgent) ? {
|
| drawingBufferHeight: null,
|
| drawingBufferWidth: null
|
| @@ -3309,20 +3345,27 @@ if (WebComponents.flags.shadow) {
|
| })(window.ShadowDOMPolyfill);
|
| (function(scope) {
|
| "use strict";
|
| + var Node = scope.wrappers.Node;
|
| var GetElementsByInterface = scope.GetElementsByInterface;
|
| var NonElementParentNodeInterface = scope.NonElementParentNodeInterface;
|
| var ParentNodeInterface = scope.ParentNodeInterface;
|
| var SelectorsInterface = scope.SelectorsInterface;
|
| var mixin = scope.mixin;
|
| var registerObject = scope.registerObject;
|
| - var DocumentFragment = registerObject(document.createDocumentFragment());
|
| + var registerWrapper = scope.registerWrapper;
|
| + var OriginalDocumentFragment = window.DocumentFragment;
|
| + function DocumentFragment(node) {
|
| + Node.call(this, node);
|
| + }
|
| + DocumentFragment.prototype = Object.create(Node.prototype);
|
| mixin(DocumentFragment.prototype, ParentNodeInterface);
|
| mixin(DocumentFragment.prototype, SelectorsInterface);
|
| mixin(DocumentFragment.prototype, GetElementsByInterface);
|
| mixin(DocumentFragment.prototype, NonElementParentNodeInterface);
|
| + registerWrapper(OriginalDocumentFragment, DocumentFragment, document.createDocumentFragment());
|
| + scope.wrappers.DocumentFragment = DocumentFragment;
|
| var Comment = registerObject(document.createComment(""));
|
| scope.wrappers.Comment = Comment;
|
| - scope.wrappers.DocumentFragment = DocumentFragment;
|
| })(window.ShadowDOMPolyfill);
|
| (function(scope) {
|
| "use strict";
|
| @@ -3336,6 +3379,7 @@ if (WebComponents.flags.shadow) {
|
| var setInnerHTML = scope.setInnerHTML;
|
| var unsafeUnwrap = scope.unsafeUnwrap;
|
| var unwrap = scope.unwrap;
|
| + var wrap = scope.wrap;
|
| var shadowHostTable = new WeakMap();
|
| var nextOlderShadowTreeTable = new WeakMap();
|
| function ShadowRoot(hostWrapper) {
|
| @@ -3368,6 +3412,28 @@ if (WebComponents.flags.shadow) {
|
| },
|
| elementFromPoint: function(x, y) {
|
| return elementFromPoint(this, this.ownerDocument, x, y);
|
| + },
|
| + getSelection: function() {
|
| + return document.getSelection();
|
| + },
|
| + get activeElement() {
|
| + var unwrappedActiveElement = unwrap(this).ownerDocument.activeElement;
|
| + if (!unwrappedActiveElement || !unwrappedActiveElement.nodeType) return null;
|
| + var activeElement = wrap(unwrappedActiveElement);
|
| + if (activeElement === this.host) {
|
| + return null;
|
| + }
|
| + while (!this.contains(activeElement) && !this.host.contains(activeElement)) {
|
| + while (activeElement.parentNode) {
|
| + activeElement = activeElement.parentNode;
|
| + }
|
| + if (activeElement.host) {
|
| + activeElement = activeElement.host;
|
| + } else {
|
| + return null;
|
| + }
|
| + }
|
| + return activeElement;
|
| }
|
| });
|
| scope.wrappers.ShadowRoot = ShadowRoot;
|
| @@ -3955,7 +4021,7 @@ if (WebComponents.flags.shadow) {
|
| unsafeUnwrap(this).removeRange(unwrap(range));
|
| },
|
| selectAllChildren: function(node) {
|
| - unsafeUnwrap(this).selectAllChildren(unwrapIfNeeded(node));
|
| + unsafeUnwrap(this).selectAllChildren(node instanceof ShadowRoot ? unsafeUnwrap(node.host) : unwrapIfNeeded(node));
|
| },
|
| toString: function() {
|
| return unsafeUnwrap(this).toString();
|
| @@ -4026,6 +4092,7 @@ if (WebComponents.flags.shadow) {
|
| var ShadowRoot = scope.wrappers.ShadowRoot;
|
| var TreeScope = scope.TreeScope;
|
| var cloneNode = scope.cloneNode;
|
| + var defineGetter = scope.defineGetter;
|
| var defineWrapGetter = scope.defineWrapGetter;
|
| var elementFromPoint = scope.elementFromPoint;
|
| var forwardMethodsToWrapper = scope.forwardMethodsToWrapper;
|
| @@ -4049,6 +4116,22 @@ if (WebComponents.flags.shadow) {
|
| defineWrapGetter(Document, "documentElement");
|
| defineWrapGetter(Document, "body");
|
| defineWrapGetter(Document, "head");
|
| + defineGetter(Document, "activeElement", function() {
|
| + var unwrappedActiveElement = unwrap(this).activeElement;
|
| + if (!unwrappedActiveElement || !unwrappedActiveElement.nodeType) return null;
|
| + var activeElement = wrap(unwrappedActiveElement);
|
| + while (!this.contains(activeElement)) {
|
| + while (activeElement.parentNode) {
|
| + activeElement = activeElement.parentNode;
|
| + }
|
| + if (activeElement.host) {
|
| + activeElement = activeElement.host;
|
| + } else {
|
| + return null;
|
| + }
|
| + }
|
| + return activeElement;
|
| + });
|
| function wrapMethod(name) {
|
| var original = document[name];
|
| Document.prototype[name] = function() {
|
| @@ -5379,9 +5462,12 @@ if (WebComponents.flags.shadow) {
|
| };
|
| }
|
| scope.URL = jURL;
|
| -})(this);
|
| +})(self);
|
|
|
| (function(global) {
|
| + if (global.JsMutationObserver) {
|
| + return;
|
| + }
|
| var registrationsTable = new WeakMap();
|
| var setImmediate;
|
| if (/Trident|Edge/.test(navigator.userAgent)) {
|
| @@ -5677,8 +5763,83 @@ if (WebComponents.flags.shadow) {
|
| }
|
| };
|
| global.JsMutationObserver = JsMutationObserver;
|
| - if (!global.MutationObserver) global.MutationObserver = JsMutationObserver;
|
| -})(this);
|
| + if (!global.MutationObserver) {
|
| + global.MutationObserver = JsMutationObserver;
|
| + JsMutationObserver._isPolyfilled = true;
|
| + }
|
| +})(self);
|
| +
|
| +(function(scope) {
|
| + "use strict";
|
| + if (!window.performance) {
|
| + var start = Date.now();
|
| + window.performance = {
|
| + now: function() {
|
| + return Date.now() - start;
|
| + }
|
| + };
|
| + }
|
| + if (!window.requestAnimationFrame) {
|
| + window.requestAnimationFrame = function() {
|
| + var nativeRaf = window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame;
|
| + return nativeRaf ? function(callback) {
|
| + return nativeRaf(function() {
|
| + callback(performance.now());
|
| + });
|
| + } : function(callback) {
|
| + return window.setTimeout(callback, 1e3 / 60);
|
| + };
|
| + }();
|
| + }
|
| + if (!window.cancelAnimationFrame) {
|
| + window.cancelAnimationFrame = function() {
|
| + return window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame || function(id) {
|
| + clearTimeout(id);
|
| + };
|
| + }();
|
| + }
|
| + var workingDefaultPrevented = function() {
|
| + var e = document.createEvent("Event");
|
| + e.initEvent("foo", true, true);
|
| + e.preventDefault();
|
| + return e.defaultPrevented;
|
| + }();
|
| + if (!workingDefaultPrevented) {
|
| + var origPreventDefault = Event.prototype.preventDefault;
|
| + Event.prototype.preventDefault = function() {
|
| + if (!this.cancelable) {
|
| + return;
|
| + }
|
| + origPreventDefault.call(this);
|
| + Object.defineProperty(this, "defaultPrevented", {
|
| + get: function() {
|
| + return true;
|
| + },
|
| + configurable: true
|
| + });
|
| + };
|
| + }
|
| + var isIE = /Trident/.test(navigator.userAgent);
|
| + if (!window.CustomEvent || isIE && typeof window.CustomEvent !== "function") {
|
| + window.CustomEvent = function(inType, params) {
|
| + params = params || {};
|
| + var e = document.createEvent("CustomEvent");
|
| + e.initCustomEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable), params.detail);
|
| + return e;
|
| + };
|
| + window.CustomEvent.prototype = window.Event.prototype;
|
| + }
|
| + if (!window.Event || isIE && typeof window.Event !== "function") {
|
| + var origEvent = window.Event;
|
| + window.Event = function(inType, params) {
|
| + params = params || {};
|
| + var e = document.createEvent("Event");
|
| + e.initEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable));
|
| + return e;
|
| + };
|
| + window.Event.prototype = origEvent.prototype;
|
| + }
|
| +})(window.WebComponents);
|
|
|
| window.HTMLImports = window.HTMLImports || {
|
| flags: {}
|
| @@ -5755,6 +5916,7 @@ window.HTMLImports = window.HTMLImports || {
|
| if (importCount) {
|
| for (var i = 0, imp; i < importCount && (imp = imports[i]); i++) {
|
| if (isImportLoaded(imp)) {
|
| + newImports.push(this);
|
| parsedCount++;
|
| checkDone();
|
| } else {
|
| @@ -5881,10 +6043,14 @@ window.HTMLImports.addModule(function(scope) {
|
| request.open("GET", url, xhr.async);
|
| request.addEventListener("readystatechange", function(e) {
|
| if (request.readyState === 4) {
|
| - var locationHeader = request.getResponseHeader("Location");
|
| var redirectedUrl = null;
|
| - if (locationHeader) {
|
| - var redirectedUrl = locationHeader.substr(0, 1) === "/" ? location.origin + locationHeader : locationHeader;
|
| + try {
|
| + var locationHeader = request.getResponseHeader("Location");
|
| + if (locationHeader) {
|
| + redirectedUrl = locationHeader.substr(0, 1) === "/" ? location.origin + locationHeader : locationHeader;
|
| + }
|
| + } catch (e) {
|
| + console.error(e.message);
|
| }
|
| next.call(nextContext, !xhr.ok(request) && request, request.response || request.responseText, redirectedUrl);
|
| }
|
| @@ -6034,7 +6200,7 @@ window.HTMLImports.addModule(function(scope) {
|
| var IMPORT_SELECTOR = "link[rel=" + IMPORT_LINK_TYPE + "]";
|
| var importParser = {
|
| documentSelectors: IMPORT_SELECTOR,
|
| - importsSelectors: [ IMPORT_SELECTOR, "link[rel=stylesheet]", "style", "script:not([type])", 'script[type="application/javascript"]', 'script[type="text/javascript"]' ].join(","),
|
| + importsSelectors: [ IMPORT_SELECTOR, "link[rel=stylesheet]:not([type])", "style:not([type])", "script:not([type])", 'script[type="application/javascript"]', 'script[type="text/javascript"]' ].join(","),
|
| map: {
|
| link: "parseLink",
|
| script: "parseScript",
|
| @@ -6085,6 +6251,7 @@ window.HTMLImports.addModule(function(scope) {
|
| }
|
| },
|
| parseImport: function(elt) {
|
| + elt.import = elt.__doc;
|
| if (window.HTMLImports.__importsParsingHook) {
|
| window.HTMLImports.__importsParsingHook(elt);
|
| }
|
| @@ -6147,6 +6314,8 @@ window.HTMLImports.addModule(function(scope) {
|
| trackElement: function(elt, callback) {
|
| var self = this;
|
| var done = function(e) {
|
| + elt.removeEventListener("load", done);
|
| + elt.removeEventListener("error", done);
|
| if (callback) {
|
| callback(e);
|
| }
|
| @@ -6184,7 +6353,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);
|
| @@ -6200,7 +6371,7 @@ window.HTMLImports.addModule(function(scope) {
|
| for (var i = 0, l = nodes.length, p = 0, n; i < l && (n = nodes[i]); i++) {
|
| if (!this.isParsed(n)) {
|
| if (this.hasResource(n)) {
|
| - return nodeIsImport(n) ? this.nextToParseInDoc(n.import, n) : n;
|
| + return nodeIsImport(n) ? this.nextToParseInDoc(n.__doc, n) : n;
|
| } else {
|
| return;
|
| }
|
| @@ -6223,7 +6394,7 @@ window.HTMLImports.addModule(function(scope) {
|
| return this.dynamicElements.indexOf(elt) >= 0;
|
| },
|
| hasResource: function(node) {
|
| - if (nodeIsImport(node) && node.import === undefined) {
|
| + if (nodeIsImport(node) && node.__doc === undefined) {
|
| return false;
|
| }
|
| return true;
|
| @@ -6297,7 +6468,7 @@ window.HTMLImports.addModule(function(scope) {
|
| }
|
| this.documents[url] = doc;
|
| }
|
| - elt.import = doc;
|
| + elt.__doc = doc;
|
| }
|
| parser.parseNext();
|
| },
|
| @@ -6393,22 +6564,6 @@ window.HTMLImports.addModule(function(scope) {
|
| if (scope.useNative) {
|
| return;
|
| }
|
| - if (isIE && typeof window.CustomEvent !== "function") {
|
| - window.CustomEvent = function(inType, params) {
|
| - params = params || {};
|
| - var e = document.createEvent("CustomEvent");
|
| - e.initCustomEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable), params.detail);
|
| - e.preventDefault = function() {
|
| - Object.defineProperty(this, "defaultPrevented", {
|
| - get: function() {
|
| - return true;
|
| - }
|
| - });
|
| - };
|
| - return e;
|
| - };
|
| - window.CustomEvent.prototype = window.Event.prototype;
|
| - }
|
| initializeModules();
|
| var rootDocument = scope.rootDocument;
|
| function bootstrap() {
|
| @@ -6439,6 +6594,7 @@ window.CustomElements = window.CustomElements || {
|
| scope.addModule = addModule;
|
| scope.initializeModules = initializeModules;
|
| scope.hasNative = Boolean(document.registerElement);
|
| + scope.isIE = /Trident/.test(navigator.userAgent);
|
| scope.useNative = !flags.register && scope.hasNative && !window.ShadowDOMPolyfill && (!window.HTMLImports || window.HTMLImports.useNative);
|
| })(window.CustomElements);
|
|
|
| @@ -6501,32 +6657,27 @@ 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 hasThrottledAttached = window.MutationObserver._isPolyfilled && flags["throttle-attached"];
|
| + scope.hasPolyfillMutations = hasThrottledAttached;
|
| + scope.hasThrottledAttached = hasThrottledAttached;
|
| var isPendingMutations = false;
|
| var pendingMutations = [];
|
| function deferMutation(fn) {
|
| @@ -6545,7 +6696,7 @@ window.CustomElements.addModule(function(scope) {
|
| pendingMutations = [];
|
| }
|
| function attached(element) {
|
| - if (hasPolyfillMutations) {
|
| + if (hasThrottledAttached) {
|
| deferMutation(function() {
|
| _attached(element);
|
| });
|
| @@ -6554,12 +6705,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();
|
| }
|
| }
|
| }
|
| @@ -6570,7 +6719,7 @@ window.CustomElements.addModule(function(scope) {
|
| });
|
| }
|
| function detached(element) {
|
| - if (hasPolyfillMutations) {
|
| + if (hasThrottledAttached) {
|
| deferMutation(function() {
|
| _detached(element);
|
| });
|
| @@ -6579,18 +6728,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 +6755,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 +6770,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 +6799,7 @@ window.CustomElements.addModule(function(scope) {
|
| }
|
| var observer = node.__observer;
|
| if (observer) {
|
| - handler(observer.takeRecords());
|
| + handler(node, observer.takeRecords());
|
| takeMutations();
|
| }
|
| }
|
| @@ -6660,7 +6808,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 +6818,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();
|
| }
|
| @@ -6687,28 +6836,32 @@ window.CustomElements.addModule(function(scope) {
|
| }
|
| scope.watchShadow = watchShadow;
|
| scope.upgradeDocumentTree = upgradeDocumentTree;
|
| + scope.upgradeDocument = upgradeDocument;
|
| 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.localName === "template") {
|
| + if (window.HTMLTemplateElement && HTMLTemplateElement.decorate) {
|
| + HTMLTemplateElement.decorate(node);
|
| + }
|
| + }
|
| if (!node.__upgraded__ && node.nodeType === Node.ELEMENT_NODE) {
|
| var is = node.getAttribute("is");
|
| - var definition = scope.getRegisteredDefinition(is || node.localName);
|
| + var definition = scope.getRegisteredDefinition(node.localName) || scope.getRegisteredDefinition(is);
|
| if (definition) {
|
| - if (is && definition.tag == node.localName) {
|
| - return upgradeWithDefinition(node, definition);
|
| - } else if (!is && !definition.extends) {
|
| - return upgradeWithDefinition(node, definition);
|
| + if (is && definition.tag == node.localName || !is && !definition.extends) {
|
| + 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 +6869,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;
|
| }
|
| @@ -6754,7 +6909,7 @@ window.CustomElements.addModule(function(scope) {
|
| });
|
|
|
| window.CustomElements.addModule(function(scope) {
|
| - var isIE11OrOlder = scope.isIE11OrOlder;
|
| + var isIE = scope.isIE;
|
| var upgradeDocumentTree = scope.upgradeDocumentTree;
|
| var upgradeAll = scope.upgradeAll;
|
| var upgradeWithDefinition = scope.upgradeWithDefinition;
|
| @@ -6845,17 +7000,23 @@ window.CustomElements.addModule(function(scope) {
|
| var nativePrototype = HTMLElement.prototype;
|
| if (definition.is) {
|
| var inst = document.createElement(definition.tag);
|
| - var expectedPrototype = Object.getPrototypeOf(inst);
|
| - if (expectedPrototype === definition.prototype) {
|
| - nativePrototype = expectedPrototype;
|
| - }
|
| + nativePrototype = Object.getPrototypeOf(inst);
|
| }
|
| var proto = definition.prototype, ancestor;
|
| - while (proto && proto !== nativePrototype) {
|
| + var foundPrototype = false;
|
| + while (proto) {
|
| + if (proto == nativePrototype) {
|
| + foundPrototype = true;
|
| + }
|
| ancestor = Object.getPrototypeOf(proto);
|
| - proto.__proto__ = ancestor;
|
| + if (ancestor) {
|
| + proto.__proto__ = ancestor;
|
| + }
|
| proto = ancestor;
|
| }
|
| + if (!foundPrototype) {
|
| + console.warn(definition.tag + " prototype not found in prototype chain for " + definition.is);
|
| + }
|
| definition.native = nativePrototype;
|
| }
|
| }
|
| @@ -6917,6 +7078,9 @@ window.CustomElements.addModule(function(scope) {
|
| var isInstance;
|
| if (!Object.__proto__ && !useNative) {
|
| isInstance = function(obj, ctor) {
|
| + if (obj instanceof ctor) {
|
| + return true;
|
| + }
|
| var p = obj;
|
| while (p) {
|
| if (p === ctor.prototype) {
|
| @@ -6941,7 +7105,7 @@ window.CustomElements.addModule(function(scope) {
|
| }
|
| wrapDomMethodToForceUpgrade(Node.prototype, "cloneNode");
|
| wrapDomMethodToForceUpgrade(document, "importNode");
|
| - if (isIE11OrOlder) {
|
| + if (isIE) {
|
| (function() {
|
| var importNode = document.importNode;
|
| document.importNode = function() {
|
| @@ -6969,7 +7133,7 @@ window.CustomElements.addModule(function(scope) {
|
| (function(scope) {
|
| var useNative = scope.useNative;
|
| var initializeModules = scope.initializeModules;
|
| - var isIE11OrOlder = /Trident/.test(navigator.userAgent);
|
| + var isIE = scope.isIE;
|
| if (useNative) {
|
| var nop = function() {};
|
| scope.watchShadow = nop;
|
| @@ -6985,6 +7149,7 @@ window.CustomElements.addModule(function(scope) {
|
| initializeModules();
|
| }
|
| var upgradeDocumentTree = scope.upgradeDocumentTree;
|
| + var upgradeDocument = scope.upgradeDocument;
|
| if (!window.wrap) {
|
| if (window.ShadowDOMPolyfill) {
|
| window.wrap = window.ShadowDOMPolyfill.wrapIfNeeded;
|
| @@ -6995,39 +7160,30 @@ window.CustomElements.addModule(function(scope) {
|
| };
|
| }
|
| }
|
| + if (window.HTMLImports) {
|
| + window.HTMLImports.__importsParsingHook = function(elt) {
|
| + if (elt.import) {
|
| + upgradeDocument(wrap(elt.import));
|
| + }
|
| + };
|
| + }
|
| function bootstrap() {
|
| upgradeDocumentTree(window.wrap(document));
|
| - if (window.HTMLImports) {
|
| - window.HTMLImports.__importsParsingHook = function(elt) {
|
| - upgradeDocumentTree(wrap(elt.import));
|
| - };
|
| - }
|
| window.CustomElements.ready = true;
|
| - setTimeout(function() {
|
| - window.CustomElements.readyTime = Date.now();
|
| - if (window.HTMLImports) {
|
| - window.CustomElements.elapsed = window.CustomElements.readyTime - window.HTMLImports.readyTime;
|
| - }
|
| - document.dispatchEvent(new CustomEvent("WebComponentsReady", {
|
| - bubbles: true
|
| - }));
|
| - });
|
| - }
|
| - if (isIE11OrOlder && typeof window.CustomEvent !== "function") {
|
| - window.CustomEvent = function(inType, params) {
|
| - params = params || {};
|
| - var e = document.createEvent("CustomEvent");
|
| - e.initCustomEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable), params.detail);
|
| - e.preventDefault = function() {
|
| - Object.defineProperty(this, "defaultPrevented", {
|
| - get: function() {
|
| - return true;
|
| - }
|
| - });
|
| - };
|
| - return e;
|
| + var requestAnimationFrame = window.requestAnimationFrame || function(f) {
|
| + setTimeout(f, 16);
|
| };
|
| - window.CustomEvent.prototype = window.Event.prototype;
|
| + requestAnimationFrame(function() {
|
| + setTimeout(function() {
|
| + window.CustomElements.readyTime = Date.now();
|
| + if (window.HTMLImports) {
|
| + window.CustomElements.elapsed = window.CustomElements.readyTime - window.HTMLImports.readyTime;
|
| + }
|
| + document.dispatchEvent(new CustomEvent("WebComponentsReady", {
|
| + bubbles: true
|
| + }));
|
| + });
|
| + });
|
| }
|
| if (document.readyState === "complete" || scope.flags.eager) {
|
| bootstrap();
|
| @@ -7037,7 +7193,6 @@ window.CustomElements.addModule(function(scope) {
|
| var loadEvent = window.HTMLImports && !window.HTMLImports.ready ? "HTMLImportsLoaded" : "DOMContentLoaded";
|
| window.addEventListener(loadEvent, bootstrap);
|
| }
|
| - scope.isIE11OrOlder = isIE11OrOlder;
|
| })(window.CustomElements);
|
|
|
| (function(scope) {
|
| @@ -7055,66 +7210,6 @@ window.CustomElements.addModule(function(scope) {
|
| })(window.WebComponents);
|
|
|
| (function(scope) {
|
| - "use strict";
|
| - if (!window.performance) {
|
| - var start = Date.now();
|
| - window.performance = {
|
| - now: function() {
|
| - return Date.now() - start;
|
| - }
|
| - };
|
| - }
|
| - if (!window.requestAnimationFrame) {
|
| - window.requestAnimationFrame = function() {
|
| - var nativeRaf = window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame;
|
| - return nativeRaf ? function(callback) {
|
| - return nativeRaf(function() {
|
| - callback(performance.now());
|
| - });
|
| - } : function(callback) {
|
| - return window.setTimeout(callback, 1e3 / 60);
|
| - };
|
| - }();
|
| - }
|
| - if (!window.cancelAnimationFrame) {
|
| - window.cancelAnimationFrame = function() {
|
| - return window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame || function(id) {
|
| - clearTimeout(id);
|
| - };
|
| - }();
|
| - }
|
| - var elementDeclarations = [];
|
| - var polymerStub = function(name, dictionary) {
|
| - if (typeof name !== "string" && arguments.length === 1) {
|
| - Array.prototype.push.call(arguments, document._currentScript);
|
| - }
|
| - elementDeclarations.push(arguments);
|
| - };
|
| - window.Polymer = polymerStub;
|
| - scope.consumeDeclarations = function(callback) {
|
| - scope.consumeDeclarations = function() {
|
| - throw "Possible attempt to load Polymer twice";
|
| - };
|
| - if (callback) {
|
| - callback(elementDeclarations);
|
| - }
|
| - elementDeclarations = null;
|
| - };
|
| - function installPolymerWarning() {
|
| - if (window.Polymer === polymerStub) {
|
| - window.Polymer = function() {
|
| - throw new Error("You tried to use polymer without loading it first. To " + 'load polymer, <link rel="import" href="' + 'components/polymer/polymer.html">');
|
| - };
|
| - }
|
| - }
|
| - if (HTMLImports.useNative) {
|
| - installPolymerWarning();
|
| - } else {
|
| - window.addEventListener("DOMContentLoaded", installPolymerWarning);
|
| - }
|
| -})(window.WebComponents);
|
| -
|
| -(function(scope) {
|
| var style = document.createElement("style");
|
| style.textContent = "" + "body {" + "transition: opacity ease-in 0.2s;" + " } \n" + "body[unresolved] {" + "opacity: 0; display: block; overflow: hidden; position: relative;" + " } \n";
|
| var head = document.querySelector("head");
|
|
|