| Index: third_party/polymer/components/webcomponentsjs/webcomponents.js
|
| diff --git a/third_party/polymer/components/webcomponentsjs/webcomponents.js b/third_party/polymer/components/webcomponentsjs/webcomponents.js
|
| index f363c0e14ce919a9afa53d56195c15efcd0da3e6..b11ce5cafb4fa055dab7fa9765e0666f2efb1187 100644
|
| --- a/third_party/polymer/components/webcomponentsjs/webcomponents.js
|
| +++ b/third_party/polymer/components/webcomponentsjs/webcomponents.js
|
| @@ -7,21 +7,17 @@
|
| * 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.22
|
| -(function() {
|
| - window.WebComponents = window.WebComponents || {
|
| - flags: {}
|
| - };
|
| +// @version 0.6.1
|
| +window.WebComponents = window.WebComponents || {};
|
| +
|
| +(function(scope) {
|
| + var flags = scope.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("=");
|
| - var match;
|
| - if (parts[0] && (match = parts[0].match(/wc-(.+)/))) {
|
| - flags[match[1]] = parts[1] || true;
|
| - }
|
| + location.search.slice(1).split("&").forEach(function(o) {
|
| + o = o.split("=");
|
| + o[0] && (flags[o[0]] = o[1] || true);
|
| });
|
| if (script) {
|
| for (var i = 0, a; a = script.attributes[i]; i++) {
|
| @@ -52,8 +48,8 @@
|
| };
|
| window.CustomElements.flags.register = flags.register;
|
| }
|
| - WebComponents.flags = flags;
|
| -})();
|
| + scope.flags = flags;
|
| +})(WebComponents);
|
|
|
| if (WebComponents.flags.shadow) {
|
| if (typeof WeakMap === "undefined") {
|
| @@ -159,7 +155,7 @@ if (WebComponents.flags.shadow) {
|
| defineProperty(object, name, nonEnumerableDataDescriptor);
|
| }
|
| getOwnPropertyNames(window);
|
| - function getWrapperConstructor(node, opt_instance) {
|
| + function getWrapperConstructor(node) {
|
| var nativePrototype = node.__proto__ || Object.getPrototypeOf(node);
|
| if (isFirefox) {
|
| try {
|
| @@ -172,7 +168,7 @@ if (WebComponents.flags.shadow) {
|
| if (wrapperConstructor) return wrapperConstructor;
|
| var parentWrapperConstructor = getWrapperConstructor(nativePrototype);
|
| var GeneratedWrapper = createWrapperConstructor(parentWrapperConstructor);
|
| - registerInternal(nativePrototype, GeneratedWrapper, opt_instance);
|
| + registerInternal(nativePrototype, GeneratedWrapper, node);
|
| return GeneratedWrapper;
|
| }
|
| function addForwardingProperties(nativePrototype, wrapperPrototype) {
|
| @@ -232,10 +228,8 @@ if (WebComponents.flags.shadow) {
|
| }
|
| var descriptor = getDescriptor(source, name);
|
| var getter, setter;
|
| - if (typeof descriptor.value === "function") {
|
| - if (allowMethod) {
|
| - target[name] = getMethod(name);
|
| - }
|
| + if (allowMethod && typeof descriptor.value === "function") {
|
| + target[name] = getMethod(name);
|
| continue;
|
| }
|
| var isEvent = isEventHandlerName(name);
|
| @@ -253,9 +247,6 @@ if (WebComponents.flags.shadow) {
|
| }
|
| }
|
| function register(nativeConstructor, wrapperConstructor, opt_instance) {
|
| - if (nativeConstructor == null) {
|
| - return;
|
| - }
|
| var nativePrototype = nativeConstructor.prototype;
|
| registerInternal(nativePrototype, wrapperConstructor, opt_instance);
|
| mixinStatics(wrapperConstructor, nativeConstructor);
|
| @@ -298,11 +289,7 @@ if (WebComponents.flags.shadow) {
|
| function wrap(impl) {
|
| if (impl === null) return null;
|
| assert(isNative(impl));
|
| - var wrapper = impl.__wrapper8e3dd93a60__;
|
| - if (wrapper != null) {
|
| - return wrapper;
|
| - }
|
| - return impl.__wrapper8e3dd93a60__ = new (getWrapperConstructor(impl, impl))(impl);
|
| + return impl.__wrapper8e3dd93a60__ || (impl.__wrapper8e3dd93a60__ = new (getWrapperConstructor(impl))(impl));
|
| }
|
| function unwrap(wrapper) {
|
| if (wrapper === null) return null;
|
| @@ -352,7 +339,6 @@ if (WebComponents.flags.shadow) {
|
| });
|
| });
|
| }
|
| - scope.addForwardingProperties = addForwardingProperties;
|
| scope.assert = assert;
|
| scope.constructorTable = constructorTable;
|
| scope.defineGetter = defineGetter;
|
| @@ -1160,24 +1146,6 @@ 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;
|
| @@ -1801,8 +1769,8 @@ if (WebComponents.flags.shadow) {
|
| var originalInsertBefore = OriginalNode.prototype.insertBefore;
|
| var originalRemoveChild = OriginalNode.prototype.removeChild;
|
| var originalReplaceChild = OriginalNode.prototype.replaceChild;
|
| - var isIEOrEdge = /Trident|Edge/.test(navigator.userAgent);
|
| - var removeChildOriginalHelper = isIEOrEdge ? function(parent, child) {
|
| + var isIe = /Trident|Edge/.test(navigator.userAgent);
|
| + var removeChildOriginalHelper = isIe ? function(parent, child) {
|
| try {
|
| originalRemoveChild.call(parent, child);
|
| } catch (ex) {
|
| @@ -2312,14 +2280,7 @@ if (WebComponents.flags.shadow) {
|
| return backwardsElement(this.previousSibling);
|
| }
|
| };
|
| - var NonElementParentNodeInterface = {
|
| - getElementById: function(id) {
|
| - if (/[ \t\n\r\f]/.test(id)) return null;
|
| - return this.querySelector('[id="' + id + '"]');
|
| - }
|
| - };
|
| scope.ChildNodeInterface = ChildNodeInterface;
|
| - scope.NonElementParentNodeInterface = NonElementParentNodeInterface;
|
| scope.ParentNodeInterface = ParentNodeInterface;
|
| })(window.ShadowDOMPolyfill);
|
| (function(scope) {
|
| @@ -2595,12 +2556,6 @@ if (WebComponents.flags.shadow) {
|
| }
|
| 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 XHTML_NS = "http://www.w3.org/1999/xhtml";
|
| - function needsSelfClosingSlash(node) {
|
| - if (node.namespaceURI !== XHTML_NS) return true;
|
| - var doctype = node.ownerDocument.doctype;
|
| - return doctype && doctype.publicId && doctype.systemId;
|
| - }
|
| function getOuterHTML(node, parentNode) {
|
| switch (node.nodeType) {
|
| case Node.ELEMENT_NODE:
|
| @@ -2610,11 +2565,9 @@ if (WebComponents.flags.shadow) {
|
| for (var i = 0, attr; attr = attrs[i]; i++) {
|
| s += " " + attr.name + '="' + escapeAttr(attr.value) + '"';
|
| }
|
| - if (voidElements[tagName]) {
|
| - if (needsSelfClosingSlash(node)) s += "/";
|
| - return s + ">";
|
| - }
|
| - return s + ">" + getInnerHTML(node) + "</" + tagName + ">";
|
| + s += ">";
|
| + if (voidElements[tagName]) return s;
|
| + return s + getInnerHTML(node) + "</" + tagName + ">";
|
|
|
| case Node.TEXT_NODE:
|
| var data = node.data;
|
| @@ -2772,7 +2725,7 @@ if (WebComponents.flags.shadow) {
|
| enumerable: true
|
| });
|
| }
|
| - [ "focus", "getBoundingClientRect", "getClientRects", "scrollIntoView" ].forEach(methodRequiresRendering);
|
| + [ "getBoundingClientRect", "getClientRects", "scrollIntoView" ].forEach(methodRequiresRendering);
|
| registerWrapper(OriginalHTMLElement, HTMLElement, document.createElement("b"));
|
| scope.wrappers.HTMLElement = HTMLElement;
|
| scope.getInnerHTML = getInnerHTML;
|
| @@ -3179,29 +3132,18 @@ if (WebComponents.flags.shadow) {
|
| "use strict";
|
| var Element = scope.wrappers.Element;
|
| var HTMLElement = scope.wrappers.HTMLElement;
|
| - var registerWrapper = scope.registerWrapper;
|
| + var registerObject = scope.registerObject;
|
| 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;
|
| }
|
| - 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"));
|
| + defineWrapGetter(SVGElement, "ownerSVGElement");
|
| scope.wrappers.SVGElement = SVGElement;
|
| })(window.ShadowDOMPolyfill);
|
| (function(scope) {
|
| @@ -3307,7 +3249,6 @@ 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;
|
| @@ -3332,10 +3273,6 @@ 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
|
| @@ -3345,27 +3282,18 @@ 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 registerWrapper = scope.registerWrapper;
|
| - var OriginalDocumentFragment = window.DocumentFragment;
|
| - function DocumentFragment(node) {
|
| - Node.call(this, node);
|
| - }
|
| - DocumentFragment.prototype = Object.create(Node.prototype);
|
| + var DocumentFragment = registerObject(document.createDocumentFragment());
|
| 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";
|
| @@ -3379,9 +3307,9 @@ 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();
|
| + var spaceCharRe = /[ \t\n\r\f]/;
|
| function ShadowRoot(hostWrapper) {
|
| var node = unwrap(unsafeUnwrap(hostWrapper).ownerDocument.createDocumentFragment());
|
| DocumentFragment.call(this, node);
|
| @@ -3413,24 +3341,9 @@ 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);
|
| - while (!this.contains(activeElement)) {
|
| - while (activeElement.parentNode) {
|
| - activeElement = activeElement.parentNode;
|
| - }
|
| - if (activeElement.host) {
|
| - activeElement = activeElement.host;
|
| - } else {
|
| - return null;
|
| - }
|
| - }
|
| - return activeElement;
|
| + getElementById: function(id) {
|
| + if (spaceCharRe.test(id)) return null;
|
| + return this.querySelector('[id="' + id + '"]');
|
| }
|
| });
|
| scope.wrappers.ShadowRoot = ShadowRoot;
|
| @@ -4018,7 +3931,7 @@ if (WebComponents.flags.shadow) {
|
| unsafeUnwrap(this).removeRange(unwrap(range));
|
| },
|
| selectAllChildren: function(node) {
|
| - unsafeUnwrap(this).selectAllChildren(node instanceof ShadowRoot ? unsafeUnwrap(node.host) : unwrapIfNeeded(node));
|
| + unsafeUnwrap(this).selectAllChildren(unwrapIfNeeded(node));
|
| },
|
| toString: function() {
|
| return unsafeUnwrap(this).toString();
|
| @@ -4083,13 +3996,11 @@ if (WebComponents.flags.shadow) {
|
| var GetElementsByInterface = scope.GetElementsByInterface;
|
| var Node = scope.wrappers.Node;
|
| var ParentNodeInterface = scope.ParentNodeInterface;
|
| - var NonElementParentNodeInterface = scope.NonElementParentNodeInterface;
|
| var Selection = scope.wrappers.Selection;
|
| var SelectorsInterface = scope.SelectorsInterface;
|
| 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;
|
| @@ -4113,29 +4024,13 @@ 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() {
|
| return wrap(original.apply(unsafeUnwrap(this), arguments));
|
| };
|
| }
|
| - [ "createComment", "createDocumentFragment", "createElement", "createElementNS", "createEvent", "createEventNS", "createRange", "createTextNode" ].forEach(wrapMethod);
|
| + [ "createComment", "createDocumentFragment", "createElement", "createElementNS", "createEvent", "createEventNS", "createRange", "createTextNode", "getElementById" ].forEach(wrapMethod);
|
| var originalAdoptNode = document.adoptNode;
|
| function adoptNodeNoRemove(node, doc) {
|
| originalAdoptNode.call(unsafeUnwrap(doc), unwrap(node));
|
| @@ -4259,7 +4154,6 @@ if (WebComponents.flags.shadow) {
|
| mixin(Document.prototype, GetElementsByInterface);
|
| mixin(Document.prototype, ParentNodeInterface);
|
| mixin(Document.prototype, SelectorsInterface);
|
| - mixin(Document.prototype, NonElementParentNodeInterface);
|
| mixin(Document.prototype, {
|
| get implementation() {
|
| var implementation = implementationTable.get(this);
|
| @@ -4278,11 +4172,6 @@ if (WebComponents.flags.shadow) {
|
| function DOMImplementation(impl) {
|
| setWrapper(impl, this);
|
| }
|
| - var originalCreateDocument = document.implementation.createDocument;
|
| - DOMImplementation.prototype.createDocument = function() {
|
| - arguments[2] = unwrap(arguments[2]);
|
| - return wrap(originalCreateDocument.apply(unsafeUnwrap(this), arguments));
|
| - };
|
| function wrapImplMethod(constructor, name) {
|
| var original = document.implementation[name];
|
| constructor.prototype[name] = function() {
|
| @@ -4296,10 +4185,11 @@ if (WebComponents.flags.shadow) {
|
| };
|
| }
|
| wrapImplMethod(DOMImplementation, "createDocumentType");
|
| + wrapImplMethod(DOMImplementation, "createDocument");
|
| wrapImplMethod(DOMImplementation, "createHTMLDocument");
|
| forwardImplMethod(DOMImplementation, "hasFeature");
|
| registerWrapper(window.DOMImplementation, DOMImplementation);
|
| - forwardMethodsToWrapper([ window.DOMImplementation ], [ "createDocument", "createDocumentType", "createHTMLDocument", "hasFeature" ]);
|
| + forwardMethodsToWrapper([ window.DOMImplementation ], [ "createDocumentType", "createDocument", "createHTMLDocument", "hasFeature" ]);
|
| scope.adoptNodeNoRemove = adoptNodeNoRemove;
|
| scope.wrappers.DOMImplementation = DOMImplementation;
|
| scope.wrappers.Document = Document;
|
| @@ -4774,7 +4664,7 @@ if (WebComponents.flags.shadow) {
|
| }
|
| }
|
| };
|
| - var selectorRe = /([^{]*)({[\s\S]*?})/gim, cssCommentRe = /\/\*[^*]*\*+([^\/*][^*]*\*+)*\//gim, cssCommentNextSelectorRe = /\/\*\s*@polyfill ([^*]*\*+([^\/*][^*]*\*+)*\/)([^{]*?){/gim, cssContentNextSelectorRe = /polyfill-next-selector[^}]*content\:[\s]*?['"](.*?)['"][;\s]*}([^{]*?){/gim, cssCommentRuleRe = /\/\*\s@polyfill-rule([^*]*\*+([^\/*][^*]*\*+)*)\//gim, cssContentRuleRe = /(polyfill-rule)[^}]*(content\:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim, cssCommentUnscopedRuleRe = /\/\*\s@polyfill-unscoped-rule([^*]*\*+([^\/*][^*]*\*+)*)\//gim, cssContentUnscopedRuleRe = /(polyfill-unscoped-rule)[^}]*(content\:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim, cssPseudoRe = /::(x-[^\s{,(]*)/gim, cssPartRe = /::part\(([^)]*)\)/gim, polyfillHost = "-shadowcsshost", polyfillHostContext = "-shadowcsscontext", parenSuffix = ")(?:\\((" + "(?:\\([^)(]*\\)|[^)(]*)+?" + ")\\))?([^,{]*)";
|
| + var selectorRe = /([^{]*)({[\s\S]*?})/gim, cssCommentRe = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim, cssCommentNextSelectorRe = /\/\*\s*@polyfill ([^*]*\*+([^/*][^*]*\*+)*\/)([^{]*?){/gim, cssContentNextSelectorRe = /polyfill-next-selector[^}]*content\:[\s]*?['"](.*?)['"][;\s]*}([^{]*?){/gim, cssCommentRuleRe = /\/\*\s@polyfill-rule([^*]*\*+([^/*][^*]*\*+)*)\//gim, cssContentRuleRe = /(polyfill-rule)[^}]*(content\:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim, cssCommentUnscopedRuleRe = /\/\*\s@polyfill-unscoped-rule([^*]*\*+([^/*][^*]*\*+)*)\//gim, cssContentUnscopedRuleRe = /(polyfill-unscoped-rule)[^}]*(content\:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim, cssPseudoRe = /::(x-[^\s{,(]*)/gim, cssPartRe = /::part\(([^)]*)\)/gim, polyfillHost = "-shadowcsshost", polyfillHostContext = "-shadowcsscontext", parenSuffix = ")(?:\\((" + "(?:\\([^)(]*\\)|[^)(]*)+?" + ")\\))?([^,{]*)";
|
| var cssColonHostRe = new RegExp("(" + polyfillHost + parenSuffix, "gim"), cssColonHostContextRe = new RegExp("(" + polyfillHostContext + parenSuffix, "gim"), selectorReSuffix = "([>\\s~+[.,{:][\\s\\S]*)?$", colonHostRe = /\:host/gim, colonHostContextRe = /\:host-context/gim, polyfillHostNoCombinator = polyfillHost + "-no-combinator", polyfillHostRe = new RegExp(polyfillHost, "gim"), polyfillHostContextRe = new RegExp(polyfillHostContext, "gim"), shadowDOMSelectorsRe = [ />>>/g, /::shadow/g, /::content/g, /\/deep\//g, /\/shadow\//g, /\/shadow-deep\//g, /\^\^/g, /\^/g ];
|
| function stylesToCssText(styles, preserveComments) {
|
| var cssText = "";
|
| @@ -5049,7 +4939,7 @@ if (WebComponents.flags.shadow) {
|
|
|
| case "scheme data":
|
| if ("?" == c) {
|
| - this._query = "?";
|
| + query = "?";
|
| state = "query";
|
| } else if ("#" == c) {
|
| this._fragment = "#";
|
| @@ -5089,8 +4979,6 @@ if (WebComponents.flags.shadow) {
|
| this._port = base._port;
|
| this._path = base._path.slice();
|
| this._query = base._query;
|
| - this._username = base._username;
|
| - this._password = base._password;
|
| break loop;
|
| } else if ("/" == c || "\\" == c) {
|
| if ("\\" == c) err("\\ is an invalid code point.");
|
| @@ -5100,8 +4988,6 @@ if (WebComponents.flags.shadow) {
|
| this._port = base._port;
|
| this._path = base._path.slice();
|
| this._query = "?";
|
| - this._username = base._username;
|
| - this._password = base._password;
|
| state = "query";
|
| } else if ("#" == c) {
|
| this._host = base._host;
|
| @@ -5109,8 +4995,6 @@ if (WebComponents.flags.shadow) {
|
| this._path = base._path.slice();
|
| this._query = base._query;
|
| this._fragment = "#";
|
| - this._username = base._username;
|
| - this._password = base._password;
|
| state = "fragment";
|
| } else {
|
| var nextC = input[cursor + 1];
|
| @@ -5118,8 +5002,6 @@ if (WebComponents.flags.shadow) {
|
| if ("file" != this._scheme || !ALPHA.test(c) || nextC != ":" && nextC != "|" || EOF != nextNextC && "/" != nextNextC && "\\" != nextNextC && "?" != nextNextC && "#" != nextNextC) {
|
| this._host = base._host;
|
| this._port = base._port;
|
| - this._username = base._username;
|
| - this._password = base._password;
|
| this._path = base._path.slice();
|
| this._path.pop();
|
| }
|
| @@ -5142,8 +5024,6 @@ if (WebComponents.flags.shadow) {
|
| if ("file" != this._scheme) {
|
| this._host = base._host;
|
| this._port = base._port;
|
| - this._username = base._username;
|
| - this._password = base._password;
|
| }
|
| state = "relative path";
|
| continue;
|
| @@ -5459,12 +5339,9 @@ if (WebComponents.flags.shadow) {
|
| };
|
| }
|
| scope.URL = jURL;
|
| -})(self);
|
| +})(this);
|
|
|
| (function(global) {
|
| - if (global.JsMutationObserver) {
|
| - return;
|
| - }
|
| var registrationsTable = new WeakMap();
|
| var setImmediate;
|
| if (/Trident|Edge/.test(navigator.userAgent)) {
|
| @@ -5760,83 +5637,8 @@ if (WebComponents.flags.shadow) {
|
| }
|
| };
|
| global.JsMutationObserver = JsMutationObserver;
|
| - 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);
|
| + if (!global.MutationObserver) global.MutationObserver = JsMutationObserver;
|
| +})(this);
|
|
|
| window.HTMLImports = window.HTMLImports || {
|
| flags: {}
|
| @@ -5847,19 +5649,19 @@ window.HTMLImports = window.HTMLImports || {
|
| var useNative = Boolean(IMPORT_LINK_TYPE in document.createElement("link"));
|
| var hasShadowDOMPolyfill = Boolean(window.ShadowDOMPolyfill);
|
| var wrap = function(node) {
|
| - return hasShadowDOMPolyfill ? window.ShadowDOMPolyfill.wrapIfNeeded(node) : node;
|
| + return hasShadowDOMPolyfill ? ShadowDOMPolyfill.wrapIfNeeded(node) : node;
|
| };
|
| var rootDocument = wrap(document);
|
| var currentScriptDescriptor = {
|
| get: function() {
|
| - var script = window.HTMLImports.currentScript || document.currentScript || (document.readyState !== "complete" ? document.scripts[document.scripts.length - 1] : null);
|
| + var script = HTMLImports.currentScript || document.currentScript || (document.readyState !== "complete" ? document.scripts[document.scripts.length - 1] : null);
|
| return wrap(script);
|
| },
|
| configurable: true
|
| };
|
| Object.defineProperty(document, "_currentScript", currentScriptDescriptor);
|
| Object.defineProperty(rootDocument, "_currentScript", currentScriptDescriptor);
|
| - var isIE = /Trident/.test(navigator.userAgent);
|
| + var isIE = /Trident|Edge/.test(navigator.userAgent);
|
| function whenReady(callback, doc) {
|
| doc = doc || rootDocument;
|
| whenDocumentReady(function() {
|
| @@ -5913,7 +5715,6 @@ 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 {
|
| @@ -5969,8 +5770,8 @@ window.HTMLImports = window.HTMLImports || {
|
| })();
|
| }
|
| whenReady(function(detail) {
|
| - window.HTMLImports.ready = true;
|
| - window.HTMLImports.readyTime = new Date().getTime();
|
| + HTMLImports.ready = true;
|
| + HTMLImports.readyTime = new Date().getTime();
|
| var evt = rootDocument.createEvent("CustomEvent");
|
| evt.initCustomEvent("HTMLImportsLoaded", true, true, detail);
|
| rootDocument.dispatchEvent(evt);
|
| @@ -5980,7 +5781,7 @@ window.HTMLImports = window.HTMLImports || {
|
| scope.rootDocument = rootDocument;
|
| scope.whenReady = whenReady;
|
| scope.isIE = isIE;
|
| -})(window.HTMLImports);
|
| +})(HTMLImports);
|
|
|
| (function(scope) {
|
| var modules = [];
|
| @@ -5994,9 +5795,9 @@ window.HTMLImports = window.HTMLImports || {
|
| };
|
| scope.addModule = addModule;
|
| scope.initializeModules = initializeModules;
|
| -})(window.HTMLImports);
|
| +})(HTMLImports);
|
|
|
| -window.HTMLImports.addModule(function(scope) {
|
| +HTMLImports.addModule(function(scope) {
|
| var CSS_URL_REGEXP = /(url\()([^)]*)(\))/g;
|
| var CSS_IMPORT_REGEXP = /(@import[\s]+(?!url\())([^;]*)(;)/g;
|
| var path = {
|
| @@ -6026,7 +5827,7 @@ window.HTMLImports.addModule(function(scope) {
|
| scope.path = path;
|
| });
|
|
|
| -window.HTMLImports.addModule(function(scope) {
|
| +HTMLImports.addModule(function(scope) {
|
| var xhr = {
|
| async: true,
|
| ok: function(request) {
|
| @@ -6040,14 +5841,10 @@ 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;
|
| - try {
|
| - var locationHeader = request.getResponseHeader("Location");
|
| - if (locationHeader) {
|
| - redirectedUrl = locationHeader.substr(0, 1) === "/" ? location.origin + locationHeader : locationHeader;
|
| - }
|
| - } catch (e) {
|
| - console.error(e.message);
|
| + if (locationHeader) {
|
| + var redirectedUrl = locationHeader.substr(0, 1) === "/" ? location.origin + locationHeader : locationHeader;
|
| }
|
| next.call(nextContext, !xhr.ok(request) && request, request.response || request.responseText, redirectedUrl);
|
| }
|
| @@ -6062,7 +5859,7 @@ window.HTMLImports.addModule(function(scope) {
|
| scope.xhr = xhr;
|
| });
|
|
|
| -window.HTMLImports.addModule(function(scope) {
|
| +HTMLImports.addModule(function(scope) {
|
| var xhr = scope.xhr;
|
| var flags = scope.flags;
|
| var Loader = function(onLoad, onComplete) {
|
| @@ -6155,7 +5952,7 @@ window.HTMLImports.addModule(function(scope) {
|
| scope.Loader = Loader;
|
| });
|
|
|
| -window.HTMLImports.addModule(function(scope) {
|
| +HTMLImports.addModule(function(scope) {
|
| var Observer = function(addCallback) {
|
| this.addCallback = addCallback;
|
| this.mo = new MutationObserver(this.handler.bind(this));
|
| @@ -6188,7 +5985,7 @@ window.HTMLImports.addModule(function(scope) {
|
| scope.Observer = Observer;
|
| });
|
|
|
| -window.HTMLImports.addModule(function(scope) {
|
| +HTMLImports.addModule(function(scope) {
|
| var path = scope.path;
|
| var rootDocument = scope.rootDocument;
|
| var flags = scope.flags;
|
| @@ -6197,7 +5994,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]:not([type])", "style:not([type])", "script:not([type])", 'script[type="application/javascript"]', 'script[type="text/javascript"]' ].join(","),
|
| + importsSelectors: [ IMPORT_SELECTOR, "link[rel=stylesheet]", "style", "script:not([type])", 'script[type="text/javascript"]' ].join(","),
|
| map: {
|
| link: "parseLink",
|
| script: "parseScript",
|
| @@ -6248,9 +6045,8 @@ window.HTMLImports.addModule(function(scope) {
|
| }
|
| },
|
| parseImport: function(elt) {
|
| - elt.import = elt.__doc;
|
| - if (window.HTMLImports.__importsParsingHook) {
|
| - window.HTMLImports.__importsParsingHook(elt);
|
| + if (HTMLImports.__importsParsingHook) {
|
| + HTMLImports.__importsParsingHook(elt);
|
| }
|
| if (elt.import) {
|
| elt.import.__importParsed = true;
|
| @@ -6311,8 +6107,6 @@ 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);
|
| }
|
| @@ -6336,11 +6130,9 @@ window.HTMLImports.addModule(function(scope) {
|
| }
|
| }
|
| if (fakeLoad) {
|
| - setTimeout(function() {
|
| - elt.dispatchEvent(new CustomEvent("load", {
|
| - bubbles: false
|
| - }));
|
| - });
|
| + elt.dispatchEvent(new CustomEvent("load", {
|
| + bubbles: false
|
| + }));
|
| }
|
| }
|
| },
|
| @@ -6350,9 +6142,7 @@ window.HTMLImports.addModule(function(scope) {
|
| script.src = scriptElt.src ? scriptElt.src : generateScriptDataUrl(scriptElt);
|
| scope.currentScript = scriptElt;
|
| this.trackElement(script, function(e) {
|
| - if (script.parentNode) {
|
| - script.parentNode.removeChild(script);
|
| - }
|
| + script.parentNode.removeChild(script);
|
| scope.currentScript = null;
|
| });
|
| this.addElementToDocument(script);
|
| @@ -6365,10 +6155,10 @@ window.HTMLImports.addModule(function(scope) {
|
| if (doc && this._mayParse.indexOf(doc) < 0) {
|
| this._mayParse.push(doc);
|
| var nodes = doc.querySelectorAll(this.parseSelectorsForNode(doc));
|
| - for (var i = 0, l = nodes.length, n; i < l && (n = nodes[i]); i++) {
|
| + 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.__doc, n) : n;
|
| + return nodeIsImport(n) ? this.nextToParseInDoc(n.import, n) : n;
|
| } else {
|
| return;
|
| }
|
| @@ -6391,7 +6181,7 @@ window.HTMLImports.addModule(function(scope) {
|
| return this.dynamicElements.indexOf(elt) >= 0;
|
| },
|
| hasResource: function(node) {
|
| - if (nodeIsImport(node) && node.__doc === undefined) {
|
| + if (nodeIsImport(node) && node.import === undefined) {
|
| return false;
|
| }
|
| return true;
|
| @@ -6425,7 +6215,7 @@ window.HTMLImports.addModule(function(scope) {
|
| scope.IMPORT_SELECTOR = IMPORT_SELECTOR;
|
| });
|
|
|
| -window.HTMLImports.addModule(function(scope) {
|
| +HTMLImports.addModule(function(scope) {
|
| var flags = scope.flags;
|
| var IMPORT_LINK_TYPE = scope.IMPORT_LINK_TYPE;
|
| var IMPORT_SELECTOR = scope.IMPORT_SELECTOR;
|
| @@ -6465,7 +6255,7 @@ window.HTMLImports.addModule(function(scope) {
|
| }
|
| this.documents[url] = doc;
|
| }
|
| - elt.__doc = doc;
|
| + elt.import = doc;
|
| }
|
| parser.parseNext();
|
| },
|
| @@ -6524,7 +6314,7 @@ window.HTMLImports.addModule(function(scope) {
|
| scope.importLoader = importLoader;
|
| });
|
|
|
| -window.HTMLImports.addModule(function(scope) {
|
| +HTMLImports.addModule(function(scope) {
|
| var parser = scope.parser;
|
| var importer = scope.importer;
|
| var dynamic = {
|
| @@ -6561,17 +6351,26 @@ 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);
|
| + return e;
|
| + };
|
| + window.CustomEvent.prototype = window.Event.prototype;
|
| + }
|
| initializeModules();
|
| var rootDocument = scope.rootDocument;
|
| function bootstrap() {
|
| - window.HTMLImports.importer.bootDocument(rootDocument);
|
| + HTMLImports.importer.bootDocument(rootDocument);
|
| }
|
| if (document.readyState === "complete" || document.readyState === "interactive" && !window.attachEvent) {
|
| bootstrap();
|
| } else {
|
| document.addEventListener("DOMContentLoaded", bootstrap);
|
| }
|
| -})(window.HTMLImports);
|
| +})(HTMLImports);
|
|
|
| window.CustomElements = window.CustomElements || {
|
| flags: {}
|
| @@ -6591,12 +6390,11 @@ 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);
|
| + scope.useNative = !flags.register && scope.hasNative && !window.ShadowDOMPolyfill && (!window.HTMLImports || HTMLImports.useNative);
|
| +})(CustomElements);
|
|
|
| -window.CustomElements.addModule(function(scope) {
|
| - var IMPORT_LINK_TYPE = window.HTMLImports ? window.HTMLImports.IMPORT_LINK_TYPE : "none";
|
| +CustomElements.addModule(function(scope) {
|
| + var IMPORT_LINK_TYPE = window.HTMLImports ? HTMLImports.IMPORT_LINK_TYPE : "none";
|
| function forSubtree(node, cb) {
|
| findAllElements(node, function(e) {
|
| if (cb(e)) {
|
| @@ -6633,7 +6431,7 @@ window.CustomElements.addModule(function(scope) {
|
| _forDocumentTree(doc, cb, []);
|
| }
|
| function _forDocumentTree(doc, cb, processingDocuments) {
|
| - doc = window.wrap(doc);
|
| + doc = wrap(doc);
|
| if (processingDocuments.indexOf(doc) >= 0) {
|
| return;
|
| }
|
| @@ -6650,31 +6448,36 @@ window.CustomElements.addModule(function(scope) {
|
| scope.forSubtree = forSubtree;
|
| });
|
|
|
| -window.CustomElements.addModule(function(scope) {
|
| +CustomElements.addModule(function(scope) {
|
| var flags = scope.flags;
|
| var forSubtree = scope.forSubtree;
|
| var forDocumentTree = scope.forDocumentTree;
|
| - function addedNode(node, isAttached) {
|
| - return added(node, isAttached) || addedSubtree(node, isAttached);
|
| + function addedNode(node) {
|
| + return added(node) || addedSubtree(node);
|
| }
|
| - function added(node, isAttached) {
|
| - if (scope.upgrade(node, isAttached)) {
|
| + function added(node) {
|
| + if (scope.upgrade(node)) {
|
| return true;
|
| }
|
| - if (isAttached) {
|
| - attached(node);
|
| - }
|
| + attached(node);
|
| }
|
| - function addedSubtree(node, isAttached) {
|
| + function addedSubtree(node) {
|
| forSubtree(node, function(e) {
|
| - if (added(e, isAttached)) {
|
| + if (added(e)) {
|
| return true;
|
| }
|
| });
|
| }
|
| - var hasThrottledAttached = window.MutationObserver._isPolyfilled && flags["throttle-attached"];
|
| - scope.hasPolyfillMutations = hasThrottledAttached;
|
| - scope.hasThrottledAttached = hasThrottledAttached;
|
| + 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;
|
| var pendingMutations = [];
|
| function deferMutation(fn) {
|
| @@ -6693,7 +6496,7 @@ window.CustomElements.addModule(function(scope) {
|
| pendingMutations = [];
|
| }
|
| function attached(element) {
|
| - if (hasThrottledAttached) {
|
| + if (hasPolyfillMutations) {
|
| deferMutation(function() {
|
| _attached(element);
|
| });
|
| @@ -6702,10 +6505,12 @@ window.CustomElements.addModule(function(scope) {
|
| }
|
| }
|
| function _attached(element) {
|
| - if (element.__upgraded__ && !element.__attached) {
|
| - element.__attached = true;
|
| - if (element.attachedCallback) {
|
| - element.attachedCallback();
|
| + if (element.__upgraded__ && (element.attachedCallback || element.detachedCallback)) {
|
| + if (!element.__attached && inDocument(element)) {
|
| + element.__attached = true;
|
| + if (element.attachedCallback) {
|
| + element.attachedCallback();
|
| + }
|
| }
|
| }
|
| }
|
| @@ -6716,7 +6521,7 @@ window.CustomElements.addModule(function(scope) {
|
| });
|
| }
|
| function detached(element) {
|
| - if (hasThrottledAttached) {
|
| + if (hasPolyfillMutations) {
|
| deferMutation(function() {
|
| _detached(element);
|
| });
|
| @@ -6725,16 +6530,18 @@ window.CustomElements.addModule(function(scope) {
|
| }
|
| }
|
| function _detached(element) {
|
| - if (element.__upgraded__ && element.__attached) {
|
| - element.__attached = false;
|
| - if (element.detachedCallback) {
|
| - element.detachedCallback();
|
| + if (element.__upgraded__ && (element.attachedCallback || element.detachedCallback)) {
|
| + if (element.__attached && !inDocument(element)) {
|
| + element.__attached = false;
|
| + if (element.detachedCallback) {
|
| + element.detachedCallback();
|
| + }
|
| }
|
| }
|
| }
|
| function inDocument(element) {
|
| var p = element;
|
| - var doc = window.wrap(document);
|
| + var doc = wrap(document);
|
| while (p) {
|
| if (p == doc) {
|
| return true;
|
| @@ -6752,7 +6559,7 @@ window.CustomElements.addModule(function(scope) {
|
| }
|
| }
|
| }
|
| - function handler(root, mutations) {
|
| + function handler(mutations) {
|
| if (flags.dom) {
|
| var mx = mutations[0];
|
| if (mx && mx.type === "childList" && mx.addedNodes) {
|
| @@ -6767,14 +6574,13 @@ 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, isAttached);
|
| + addedNode(n);
|
| });
|
| forEach(mx.removedNodes, function(n) {
|
| if (!n.localName) {
|
| @@ -6787,16 +6593,16 @@ window.CustomElements.addModule(function(scope) {
|
| flags.dom && console.groupEnd();
|
| }
|
| function takeRecords(node) {
|
| - node = window.wrap(node);
|
| + node = wrap(node);
|
| if (!node) {
|
| - node = window.wrap(document);
|
| + node = wrap(document);
|
| }
|
| while (node.parentNode) {
|
| node = node.parentNode;
|
| }
|
| var observer = node.__observer;
|
| if (observer) {
|
| - handler(node, observer.takeRecords());
|
| + handler(observer.takeRecords());
|
| takeMutations();
|
| }
|
| }
|
| @@ -6805,7 +6611,7 @@ window.CustomElements.addModule(function(scope) {
|
| if (inRoot.__observer) {
|
| return;
|
| }
|
| - var observer = new MutationObserver(handler.bind(this, inRoot));
|
| + var observer = new MutationObserver(handler);
|
| observer.observe(inRoot, {
|
| childList: true,
|
| subtree: true
|
| @@ -6813,10 +6619,9 @@ window.CustomElements.addModule(function(scope) {
|
| inRoot.__observer = observer;
|
| }
|
| function upgradeDocument(doc) {
|
| - doc = window.wrap(doc);
|
| + doc = wrap(doc);
|
| flags.dom && console.group("upgradeDocument: ", doc.baseURI.split("/").pop());
|
| - var isMainDocument = doc === window.wrap(document);
|
| - addedNode(doc, isMainDocument);
|
| + addedNode(doc);
|
| observe(doc);
|
| flags.dom && console.groupEnd();
|
| }
|
| @@ -6827,38 +6632,34 @@ window.CustomElements.addModule(function(scope) {
|
| if (originalCreateShadowRoot) {
|
| Element.prototype.createShadowRoot = function() {
|
| var root = originalCreateShadowRoot.call(this);
|
| - window.CustomElements.watchShadow(this);
|
| + CustomElements.watchShadow(this);
|
| return root;
|
| };
|
| }
|
| scope.watchShadow = watchShadow;
|
| scope.upgradeDocumentTree = upgradeDocumentTree;
|
| - scope.upgradeDocument = upgradeDocument;
|
| scope.upgradeSubtree = addedSubtree;
|
| scope.upgradeAll = addedNode;
|
| - scope.attached = attached;
|
| + scope.attachedNode = attachedNode;
|
| scope.takeRecords = takeRecords;
|
| });
|
|
|
| -window.CustomElements.addModule(function(scope) {
|
| +CustomElements.addModule(function(scope) {
|
| var flags = scope.flags;
|
| - function upgrade(node, isAttached) {
|
| - if (node.localName === "template") {
|
| - if (window.HTMLTemplateElement && HTMLTemplateElement.decorate) {
|
| - HTMLTemplateElement.decorate(node);
|
| - }
|
| - }
|
| + function upgrade(node) {
|
| if (!node.__upgraded__ && node.nodeType === Node.ELEMENT_NODE) {
|
| var is = node.getAttribute("is");
|
| - var definition = scope.getRegisteredDefinition(node.localName) || scope.getRegisteredDefinition(is);
|
| + var definition = scope.getRegisteredDefinition(is || node.localName);
|
| if (definition) {
|
| - if (is && definition.tag == node.localName || !is && !definition.extends) {
|
| - return upgradeWithDefinition(node, definition, isAttached);
|
| + if (is && definition.tag == node.localName) {
|
| + return upgradeWithDefinition(node, definition);
|
| + } else if (!is && !definition.extends) {
|
| + return upgradeWithDefinition(node, definition);
|
| }
|
| }
|
| }
|
| }
|
| - function upgradeWithDefinition(element, definition, isAttached) {
|
| + function upgradeWithDefinition(element, definition) {
|
| flags.upgrade && console.group("upgrade:", element.localName);
|
| if (definition.is) {
|
| element.setAttribute("is", definition.is);
|
| @@ -6866,10 +6667,8 @@ window.CustomElements.addModule(function(scope) {
|
| implementPrototype(element, definition);
|
| element.__upgraded__ = true;
|
| created(element);
|
| - if (isAttached) {
|
| - scope.attached(element);
|
| - }
|
| - scope.upgradeSubtree(element, isAttached);
|
| + scope.attachedNode(element);
|
| + scope.upgradeSubtree(element);
|
| flags.upgrade && console.groupEnd();
|
| return element;
|
| }
|
| @@ -6905,8 +6704,8 @@ window.CustomElements.addModule(function(scope) {
|
| scope.implementPrototype = implementPrototype;
|
| });
|
|
|
| -window.CustomElements.addModule(function(scope) {
|
| - var isIE = scope.isIE;
|
| +CustomElements.addModule(function(scope) {
|
| + var isIE11OrOlder = scope.isIE11OrOlder;
|
| var upgradeDocumentTree = scope.upgradeDocumentTree;
|
| var upgradeAll = scope.upgradeAll;
|
| var upgradeWithDefinition = scope.upgradeWithDefinition;
|
| @@ -6930,9 +6729,6 @@ window.CustomElements.addModule(function(scope) {
|
| definition.prototype = Object.create(HTMLElement.prototype);
|
| }
|
| definition.__name = name.toLowerCase();
|
| - if (definition.extends) {
|
| - definition.extends = definition.extends.toLowerCase();
|
| - }
|
| definition.lifecycle = definition.lifecycle || {};
|
| definition.ancestry = ancestry(definition.extends);
|
| resolveTagName(definition);
|
| @@ -7000,23 +6796,17 @@ window.CustomElements.addModule(function(scope) {
|
| var nativePrototype = HTMLElement.prototype;
|
| if (definition.is) {
|
| var inst = document.createElement(definition.tag);
|
| - nativePrototype = Object.getPrototypeOf(inst);
|
| + var expectedPrototype = Object.getPrototypeOf(inst);
|
| + if (expectedPrototype === definition.prototype) {
|
| + nativePrototype = expectedPrototype;
|
| + }
|
| }
|
| var proto = definition.prototype, ancestor;
|
| - var foundPrototype = false;
|
| - while (proto) {
|
| - if (proto == nativePrototype) {
|
| - foundPrototype = true;
|
| - }
|
| + while (proto && proto !== nativePrototype) {
|
| ancestor = Object.getPrototypeOf(proto);
|
| - if (ancestor) {
|
| - proto.__proto__ = ancestor;
|
| - }
|
| + proto.__proto__ = ancestor;
|
| proto = ancestor;
|
| }
|
| - if (!foundPrototype) {
|
| - console.warn(definition.tag + " prototype not found in prototype chain for " + definition.is);
|
| - }
|
| definition.native = nativePrototype;
|
| }
|
| }
|
| @@ -7046,12 +6836,6 @@ window.CustomElements.addModule(function(scope) {
|
| }
|
| }
|
| function createElement(tag, typeExtension) {
|
| - if (tag) {
|
| - tag = tag.toLowerCase();
|
| - }
|
| - if (typeExtension) {
|
| - typeExtension = typeExtension.toLowerCase();
|
| - }
|
| var definition = getRegisteredDefinition(typeExtension || tag);
|
| if (definition) {
|
| if (tag == definition.tag && typeExtension == definition.is) {
|
| @@ -7078,9 +6862,6 @@ 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) {
|
| @@ -7105,6 +6886,21 @@ window.CustomElements.addModule(function(scope) {
|
| }
|
| wrapDomMethodToForceUpgrade(Node.prototype, "cloneNode");
|
| wrapDomMethodToForceUpgrade(document, "importNode");
|
| + if (isIE11OrOlder) {
|
| + (function() {
|
| + var importNode = document.importNode;
|
| + document.importNode = function() {
|
| + var n = importNode.apply(document, arguments);
|
| + if (n.nodeType == n.DOCUMENT_FRAGMENT_NODE) {
|
| + var f = document.createDocumentFragment();
|
| + f.appendChild(n);
|
| + return f;
|
| + } else {
|
| + return n;
|
| + }
|
| + };
|
| + })();
|
| + }
|
| document.registerElement = register;
|
| document.createElement = createElement;
|
| document.createElementNS = createElementNS;
|
| @@ -7118,7 +6914,7 @@ window.CustomElements.addModule(function(scope) {
|
| (function(scope) {
|
| var useNative = scope.useNative;
|
| var initializeModules = scope.initializeModules;
|
| - var isIE = scope.isIE;
|
| + var isIE11OrOlder = /Trident/.test(navigator.userAgent);
|
| if (useNative) {
|
| var nop = function() {};
|
| scope.watchShadow = nop;
|
| @@ -7134,50 +6930,52 @@ 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;
|
| - window.unwrap = window.ShadowDOMPolyfill.unwrapIfNeeded;
|
| + window.wrap = ShadowDOMPolyfill.wrapIfNeeded;
|
| + window.unwrap = ShadowDOMPolyfill.unwrapIfNeeded;
|
| } else {
|
| window.wrap = window.unwrap = function(node) {
|
| return node;
|
| };
|
| }
|
| }
|
| - if (window.HTMLImports) {
|
| - window.HTMLImports.__importsParsingHook = function(elt) {
|
| - if (elt.import) {
|
| - upgradeDocument(wrap(elt.import));
|
| + function bootstrap() {
|
| + upgradeDocumentTree(wrap(document));
|
| + if (window.HTMLImports) {
|
| + HTMLImports.__importsParsingHook = function(elt) {
|
| + upgradeDocumentTree(wrap(elt.import));
|
| + };
|
| + }
|
| + CustomElements.ready = true;
|
| + setTimeout(function() {
|
| + CustomElements.readyTime = Date.now();
|
| + if (window.HTMLImports) {
|
| + CustomElements.elapsed = CustomElements.readyTime - HTMLImports.readyTime;
|
| }
|
| - };
|
| + document.dispatchEvent(new CustomEvent("WebComponentsReady", {
|
| + bubbles: true
|
| + }));
|
| + });
|
| }
|
| - function bootstrap() {
|
| - upgradeDocumentTree(window.wrap(document));
|
| - window.CustomElements.ready = true;
|
| - var requestAnimationFrame = window.requestAnimationFrame || function(f) {
|
| - setTimeout(f, 16);
|
| + 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);
|
| + return e;
|
| };
|
| - 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
|
| - }));
|
| - });
|
| - });
|
| + window.CustomEvent.prototype = window.Event.prototype;
|
| }
|
| if (document.readyState === "complete" || scope.flags.eager) {
|
| bootstrap();
|
| } else if (document.readyState === "interactive" && !window.attachEvent && (!window.HTMLImports || window.HTMLImports.ready)) {
|
| bootstrap();
|
| } else {
|
| - var loadEvent = window.HTMLImports && !window.HTMLImports.ready ? "HTMLImportsLoaded" : "DOMContentLoaded";
|
| + var loadEvent = window.HTMLImports && !HTMLImports.ready ? "HTMLImportsLoaded" : "DOMContentLoaded";
|
| window.addEventListener(loadEvent, bootstrap);
|
| }
|
| + scope.isIE11OrOlder = isIE11OrOlder;
|
| })(window.CustomElements);
|
|
|
| (function(scope) {
|
| @@ -7195,6 +6993,66 @@ 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 {
|
| + 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");
|
|
|