Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(325)

Side by Side Diff: third_party/polymer/components/webcomponentsjs/webcomponents.js

Issue 2113853002: Run bower update (Closed) Base URL: https://github.com/catapult-project/catapult@polymer10-migration
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /** 1 /**
2 * @license 2 * @license
3 * Copyright (c) 2014 The Polymer Project Authors. All rights reserved. 3 * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
4 * This code may only be used under the BSD style license found at http://polyme r.github.io/LICENSE.txt 4 * This code may only be used under the BSD style license found at http://polyme r.github.io/LICENSE.txt
5 * The complete set of authors may be found at http://polymer.github.io/AUTHORS. txt 5 * The complete set of authors may be found at http://polymer.github.io/AUTHORS. txt
6 * The complete set of contributors may be found at http://polymer.github.io/CON TRIBUTORS.txt 6 * The complete set of contributors may be found at http://polymer.github.io/CON TRIBUTORS.txt
7 * Code distributed by Google as part of the polymer project is also 7 * Code distributed by Google as part of the polymer project is also
8 * subject to an additional IP rights grant found at http://polymer.github.io/PA TENTS.txt 8 * subject to an additional IP rights grant found at http://polymer.github.io/PA TENTS.txt
9 */ 9 */
10 // @version 0.7.22 10 // @version 0.6.1
11 (function() { 11 window.WebComponents = window.WebComponents || {};
12 window.WebComponents = window.WebComponents || { 12
13 flags: {} 13 (function(scope) {
14 }; 14 var flags = scope.flags || {};
15 var file = "webcomponents.js"; 15 var file = "webcomponents.js";
16 var script = document.querySelector('script[src*="' + file + '"]'); 16 var script = document.querySelector('script[src*="' + file + '"]');
17 var flags = {};
18 if (!flags.noOpts) { 17 if (!flags.noOpts) {
19 location.search.slice(1).split("&").forEach(function(option) { 18 location.search.slice(1).split("&").forEach(function(o) {
20 var parts = option.split("="); 19 o = o.split("=");
21 var match; 20 o[0] && (flags[o[0]] = o[1] || true);
22 if (parts[0] && (match = parts[0].match(/wc-(.+)/))) {
23 flags[match[1]] = parts[1] || true;
24 }
25 }); 21 });
26 if (script) { 22 if (script) {
27 for (var i = 0, a; a = script.attributes[i]; i++) { 23 for (var i = 0, a; a = script.attributes[i]; i++) {
28 if (a.name !== "src") { 24 if (a.name !== "src") {
29 flags[a.name] = a.value || true; 25 flags[a.name] = a.value || true;
30 } 26 }
31 } 27 }
32 } 28 }
33 if (flags.log && flags.log.split) { 29 if (flags.log && flags.log.split) {
34 var parts = flags.log.split(","); 30 var parts = flags.log.split(",");
(...skipping 10 matching lines...) Expand all
45 flags.shadow = false; 41 flags.shadow = false;
46 } else { 42 } else {
47 flags.shadow = flags.shadow || !HTMLElement.prototype.createShadowRoot; 43 flags.shadow = flags.shadow || !HTMLElement.prototype.createShadowRoot;
48 } 44 }
49 if (flags.register) { 45 if (flags.register) {
50 window.CustomElements = window.CustomElements || { 46 window.CustomElements = window.CustomElements || {
51 flags: {} 47 flags: {}
52 }; 48 };
53 window.CustomElements.flags.register = flags.register; 49 window.CustomElements.flags.register = flags.register;
54 } 50 }
55 WebComponents.flags = flags; 51 scope.flags = flags;
56 })(); 52 })(WebComponents);
57 53
58 if (WebComponents.flags.shadow) { 54 if (WebComponents.flags.shadow) {
59 if (typeof WeakMap === "undefined") { 55 if (typeof WeakMap === "undefined") {
60 (function() { 56 (function() {
61 var defineProperty = Object.defineProperty; 57 var defineProperty = Object.defineProperty;
62 var counter = Date.now() % 1e9; 58 var counter = Date.now() % 1e9;
63 var WeakMap = function() { 59 var WeakMap = function() {
64 this.name = "__st" + (Math.random() * 1e9 >>> 0) + (counter++ + "__"); 60 this.name = "__st" + (Math.random() * 1e9 >>> 0) + (counter++ + "__");
65 }; 61 };
66 WeakMap.prototype = { 62 WeakMap.prototype = {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 value: undefined, 148 value: undefined,
153 configurable: true, 149 configurable: true,
154 enumerable: false, 150 enumerable: false,
155 writable: true 151 writable: true
156 }; 152 };
157 function defineNonEnumerableDataProperty(object, name, value) { 153 function defineNonEnumerableDataProperty(object, name, value) {
158 nonEnumerableDataDescriptor.value = value; 154 nonEnumerableDataDescriptor.value = value;
159 defineProperty(object, name, nonEnumerableDataDescriptor); 155 defineProperty(object, name, nonEnumerableDataDescriptor);
160 } 156 }
161 getOwnPropertyNames(window); 157 getOwnPropertyNames(window);
162 function getWrapperConstructor(node, opt_instance) { 158 function getWrapperConstructor(node) {
163 var nativePrototype = node.__proto__ || Object.getPrototypeOf(node); 159 var nativePrototype = node.__proto__ || Object.getPrototypeOf(node);
164 if (isFirefox) { 160 if (isFirefox) {
165 try { 161 try {
166 getOwnPropertyNames(nativePrototype); 162 getOwnPropertyNames(nativePrototype);
167 } catch (error) { 163 } catch (error) {
168 nativePrototype = nativePrototype.__proto__; 164 nativePrototype = nativePrototype.__proto__;
169 } 165 }
170 } 166 }
171 var wrapperConstructor = constructorTable.get(nativePrototype); 167 var wrapperConstructor = constructorTable.get(nativePrototype);
172 if (wrapperConstructor) return wrapperConstructor; 168 if (wrapperConstructor) return wrapperConstructor;
173 var parentWrapperConstructor = getWrapperConstructor(nativePrototype); 169 var parentWrapperConstructor = getWrapperConstructor(nativePrototype);
174 var GeneratedWrapper = createWrapperConstructor(parentWrapperConstructor); 170 var GeneratedWrapper = createWrapperConstructor(parentWrapperConstructor);
175 registerInternal(nativePrototype, GeneratedWrapper, opt_instance); 171 registerInternal(nativePrototype, GeneratedWrapper, node);
176 return GeneratedWrapper; 172 return GeneratedWrapper;
177 } 173 }
178 function addForwardingProperties(nativePrototype, wrapperPrototype) { 174 function addForwardingProperties(nativePrototype, wrapperPrototype) {
179 installProperty(nativePrototype, wrapperPrototype, true); 175 installProperty(nativePrototype, wrapperPrototype, true);
180 } 176 }
181 function registerInstanceProperties(wrapperPrototype, instanceObject) { 177 function registerInstanceProperties(wrapperPrototype, instanceObject) {
182 installProperty(instanceObject, wrapperPrototype, false); 178 installProperty(instanceObject, wrapperPrototype, false);
183 } 179 }
184 var isFirefox = /Firefox/.test(navigator.userAgent); 180 var isFirefox = /Firefox/.test(navigator.userAgent);
185 var dummyDescriptor = { 181 var dummyDescriptor = {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 for (var i = 0; i < names.length; i++) { 221 for (var i = 0; i < names.length; i++) {
226 var name = names[i]; 222 var name = names[i];
227 if (name === "polymerBlackList_") continue; 223 if (name === "polymerBlackList_") continue;
228 if (name in target) continue; 224 if (name in target) continue;
229 if (source.polymerBlackList_ && source.polymerBlackList_[name]) continue ; 225 if (source.polymerBlackList_ && source.polymerBlackList_[name]) continue ;
230 if (isFirefox) { 226 if (isFirefox) {
231 source.__lookupGetter__(name); 227 source.__lookupGetter__(name);
232 } 228 }
233 var descriptor = getDescriptor(source, name); 229 var descriptor = getDescriptor(source, name);
234 var getter, setter; 230 var getter, setter;
235 if (typeof descriptor.value === "function") { 231 if (allowMethod && typeof descriptor.value === "function") {
236 if (allowMethod) { 232 target[name] = getMethod(name);
237 target[name] = getMethod(name);
238 }
239 continue; 233 continue;
240 } 234 }
241 var isEvent = isEventHandlerName(name); 235 var isEvent = isEventHandlerName(name);
242 if (isEvent) getter = scope.getEventHandlerGetter(name); else getter = g etGetter(name); 236 if (isEvent) getter = scope.getEventHandlerGetter(name); else getter = g etGetter(name);
243 if (descriptor.writable || descriptor.set || isBrokenSafari) { 237 if (descriptor.writable || descriptor.set || isBrokenSafari) {
244 if (isEvent) setter = scope.getEventHandlerSetter(name); else setter = getSetter(name); 238 if (isEvent) setter = scope.getEventHandlerSetter(name); else setter = getSetter(name);
245 } 239 }
246 var configurable = isBrokenSafari || descriptor.configurable; 240 var configurable = isBrokenSafari || descriptor.configurable;
247 defineProperty(target, name, { 241 defineProperty(target, name, {
248 get: getter, 242 get: getter,
249 set: setter, 243 set: setter,
250 configurable: configurable, 244 configurable: configurable,
251 enumerable: descriptor.enumerable 245 enumerable: descriptor.enumerable
252 }); 246 });
253 } 247 }
254 } 248 }
255 function register(nativeConstructor, wrapperConstructor, opt_instance) { 249 function register(nativeConstructor, wrapperConstructor, opt_instance) {
256 if (nativeConstructor == null) {
257 return;
258 }
259 var nativePrototype = nativeConstructor.prototype; 250 var nativePrototype = nativeConstructor.prototype;
260 registerInternal(nativePrototype, wrapperConstructor, opt_instance); 251 registerInternal(nativePrototype, wrapperConstructor, opt_instance);
261 mixinStatics(wrapperConstructor, nativeConstructor); 252 mixinStatics(wrapperConstructor, nativeConstructor);
262 } 253 }
263 function registerInternal(nativePrototype, wrapperConstructor, opt_instance) { 254 function registerInternal(nativePrototype, wrapperConstructor, opt_instance) {
264 var wrapperPrototype = wrapperConstructor.prototype; 255 var wrapperPrototype = wrapperConstructor.prototype;
265 assert(constructorTable.get(nativePrototype) === undefined); 256 assert(constructorTable.get(nativePrototype) === undefined);
266 constructorTable.set(nativePrototype, wrapperConstructor); 257 constructorTable.set(nativePrototype, wrapperConstructor);
267 nativePrototypeTable.set(wrapperPrototype, nativePrototype); 258 nativePrototypeTable.set(wrapperPrototype, nativePrototype);
268 addForwardingProperties(nativePrototype, wrapperPrototype); 259 addForwardingProperties(nativePrototype, wrapperPrototype);
(...skipping 22 matching lines...) Expand all
291 } 282 }
292 function isWrapper(object) { 283 function isWrapper(object) {
293 return object && object.__impl4cf1e782hg__; 284 return object && object.__impl4cf1e782hg__;
294 } 285 }
295 function isNative(object) { 286 function isNative(object) {
296 return !isWrapper(object); 287 return !isWrapper(object);
297 } 288 }
298 function wrap(impl) { 289 function wrap(impl) {
299 if (impl === null) return null; 290 if (impl === null) return null;
300 assert(isNative(impl)); 291 assert(isNative(impl));
301 var wrapper = impl.__wrapper8e3dd93a60__; 292 return impl.__wrapper8e3dd93a60__ || (impl.__wrapper8e3dd93a60__ = new (ge tWrapperConstructor(impl))(impl));
302 if (wrapper != null) {
303 return wrapper;
304 }
305 return impl.__wrapper8e3dd93a60__ = new (getWrapperConstructor(impl, impl) )(impl);
306 } 293 }
307 function unwrap(wrapper) { 294 function unwrap(wrapper) {
308 if (wrapper === null) return null; 295 if (wrapper === null) return null;
309 assert(isWrapper(wrapper)); 296 assert(isWrapper(wrapper));
310 return wrapper.__impl4cf1e782hg__; 297 return wrapper.__impl4cf1e782hg__;
311 } 298 }
312 function unsafeUnwrap(wrapper) { 299 function unsafeUnwrap(wrapper) {
313 return wrapper.__impl4cf1e782hg__; 300 return wrapper.__impl4cf1e782hg__;
314 } 301 }
315 function setWrapper(impl, wrapper) { 302 function setWrapper(impl, wrapper) {
(...skipping 29 matching lines...) Expand all
345 function forwardMethodsToWrapper(constructors, names) { 332 function forwardMethodsToWrapper(constructors, names) {
346 constructors.forEach(function(constructor) { 333 constructors.forEach(function(constructor) {
347 names.forEach(function(name) { 334 names.forEach(function(name) {
348 constructor.prototype[name] = function() { 335 constructor.prototype[name] = function() {
349 var w = wrapIfNeeded(this); 336 var w = wrapIfNeeded(this);
350 return w[name].apply(w, arguments); 337 return w[name].apply(w, arguments);
351 }; 338 };
352 }); 339 });
353 }); 340 });
354 } 341 }
355 scope.addForwardingProperties = addForwardingProperties;
356 scope.assert = assert; 342 scope.assert = assert;
357 scope.constructorTable = constructorTable; 343 scope.constructorTable = constructorTable;
358 scope.defineGetter = defineGetter; 344 scope.defineGetter = defineGetter;
359 scope.defineWrapGetter = defineWrapGetter; 345 scope.defineWrapGetter = defineWrapGetter;
360 scope.forwardMethodsToWrapper = forwardMethodsToWrapper; 346 scope.forwardMethodsToWrapper = forwardMethodsToWrapper;
361 scope.isIdentifierName = isIdentifierName; 347 scope.isIdentifierName = isIdentifierName;
362 scope.isWrapper = isWrapper; 348 scope.isWrapper = isWrapper;
363 scope.isWrapperFor = isWrapperFor; 349 scope.isWrapperFor = isWrapperFor;
364 scope.mixin = mixin; 350 scope.mixin = mixin;
365 scope.nativePrototypeTable = nativePrototypeTable; 351 scope.nativePrototypeTable = nativePrototypeTable;
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after
1153 return eventPath.slice(); 1139 return eventPath.slice();
1154 }, 1140 },
1155 stopPropagation: function() { 1141 stopPropagation: function() {
1156 stopPropagationTable.set(this, true); 1142 stopPropagationTable.set(this, true);
1157 }, 1143 },
1158 stopImmediatePropagation: function() { 1144 stopImmediatePropagation: function() {
1159 stopPropagationTable.set(this, true); 1145 stopPropagationTable.set(this, true);
1160 stopImmediatePropagationTable.set(this, true); 1146 stopImmediatePropagationTable.set(this, true);
1161 } 1147 }
1162 }; 1148 };
1163 var supportsDefaultPrevented = function() {
1164 var e = document.createEvent("Event");
1165 e.initEvent("test", true, true);
1166 e.preventDefault();
1167 return e.defaultPrevented;
1168 }();
1169 if (!supportsDefaultPrevented) {
1170 Event.prototype.preventDefault = function() {
1171 if (!this.cancelable) return;
1172 unsafeUnwrap(this).preventDefault();
1173 Object.defineProperty(this, "defaultPrevented", {
1174 get: function() {
1175 return true;
1176 },
1177 configurable: true
1178 });
1179 };
1180 }
1181 registerWrapper(OriginalEvent, Event, document.createEvent("Event")); 1149 registerWrapper(OriginalEvent, Event, document.createEvent("Event"));
1182 function unwrapOptions(options) { 1150 function unwrapOptions(options) {
1183 if (!options || !options.relatedTarget) return options; 1151 if (!options || !options.relatedTarget) return options;
1184 return Object.create(options, { 1152 return Object.create(options, {
1185 relatedTarget: { 1153 relatedTarget: {
1186 value: unwrap(options.relatedTarget) 1154 value: unwrap(options.relatedTarget)
1187 } 1155 }
1188 }); 1156 });
1189 } 1157 }
1190 function registerGenericEvent(name, SuperEvent, prototype) { 1158 function registerGenericEvent(name, SuperEvent, prototype) {
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
1794 this.previousSibling_ = undefined; 1762 this.previousSibling_ = undefined;
1795 this.treeScope_ = undefined; 1763 this.treeScope_ = undefined;
1796 } 1764 }
1797 var OriginalDocumentFragment = window.DocumentFragment; 1765 var OriginalDocumentFragment = window.DocumentFragment;
1798 var originalAppendChild = OriginalNode.prototype.appendChild; 1766 var originalAppendChild = OriginalNode.prototype.appendChild;
1799 var originalCompareDocumentPosition = OriginalNode.prototype.compareDocument Position; 1767 var originalCompareDocumentPosition = OriginalNode.prototype.compareDocument Position;
1800 var originalIsEqualNode = OriginalNode.prototype.isEqualNode; 1768 var originalIsEqualNode = OriginalNode.prototype.isEqualNode;
1801 var originalInsertBefore = OriginalNode.prototype.insertBefore; 1769 var originalInsertBefore = OriginalNode.prototype.insertBefore;
1802 var originalRemoveChild = OriginalNode.prototype.removeChild; 1770 var originalRemoveChild = OriginalNode.prototype.removeChild;
1803 var originalReplaceChild = OriginalNode.prototype.replaceChild; 1771 var originalReplaceChild = OriginalNode.prototype.replaceChild;
1804 var isIEOrEdge = /Trident|Edge/.test(navigator.userAgent); 1772 var isIe = /Trident|Edge/.test(navigator.userAgent);
1805 var removeChildOriginalHelper = isIEOrEdge ? function(parent, child) { 1773 var removeChildOriginalHelper = isIe ? function(parent, child) {
1806 try { 1774 try {
1807 originalRemoveChild.call(parent, child); 1775 originalRemoveChild.call(parent, child);
1808 } catch (ex) { 1776 } catch (ex) {
1809 if (!(parent instanceof OriginalDocumentFragment)) throw ex; 1777 if (!(parent instanceof OriginalDocumentFragment)) throw ex;
1810 } 1778 }
1811 } : function(parent, child) { 1779 } : function(parent, child) {
1812 originalRemoveChild.call(parent, child); 1780 originalRemoveChild.call(parent, child);
1813 }; 1781 };
1814 Node.prototype = Object.create(EventTarget.prototype); 1782 Node.prototype = Object.create(EventTarget.prototype);
1815 mixin(Node.prototype, { 1783 mixin(Node.prototype, {
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
2305 } 2273 }
2306 }; 2274 };
2307 var ChildNodeInterface = { 2275 var ChildNodeInterface = {
2308 get nextElementSibling() { 2276 get nextElementSibling() {
2309 return forwardElement(this.nextSibling); 2277 return forwardElement(this.nextSibling);
2310 }, 2278 },
2311 get previousElementSibling() { 2279 get previousElementSibling() {
2312 return backwardsElement(this.previousSibling); 2280 return backwardsElement(this.previousSibling);
2313 } 2281 }
2314 }; 2282 };
2315 var NonElementParentNodeInterface = {
2316 getElementById: function(id) {
2317 if (/[ \t\n\r\f]/.test(id)) return null;
2318 return this.querySelector('[id="' + id + '"]');
2319 }
2320 };
2321 scope.ChildNodeInterface = ChildNodeInterface; 2283 scope.ChildNodeInterface = ChildNodeInterface;
2322 scope.NonElementParentNodeInterface = NonElementParentNodeInterface;
2323 scope.ParentNodeInterface = ParentNodeInterface; 2284 scope.ParentNodeInterface = ParentNodeInterface;
2324 })(window.ShadowDOMPolyfill); 2285 })(window.ShadowDOMPolyfill);
2325 (function(scope) { 2286 (function(scope) {
2326 "use strict"; 2287 "use strict";
2327 var ChildNodeInterface = scope.ChildNodeInterface; 2288 var ChildNodeInterface = scope.ChildNodeInterface;
2328 var Node = scope.wrappers.Node; 2289 var Node = scope.wrappers.Node;
2329 var enqueueMutation = scope.enqueueMutation; 2290 var enqueueMutation = scope.enqueueMutation;
2330 var mixin = scope.mixin; 2291 var mixin = scope.mixin;
2331 var registerWrapper = scope.registerWrapper; 2292 var registerWrapper = scope.registerWrapper;
2332 var unsafeUnwrap = scope.unsafeUnwrap; 2293 var unsafeUnwrap = scope.unsafeUnwrap;
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
2588 } 2549 }
2589 function makeSet(arr) { 2550 function makeSet(arr) {
2590 var set = {}; 2551 var set = {};
2591 for (var i = 0; i < arr.length; i++) { 2552 for (var i = 0; i < arr.length; i++) {
2592 set[arr[i]] = true; 2553 set[arr[i]] = true;
2593 } 2554 }
2594 return set; 2555 return set;
2595 } 2556 }
2596 var voidElements = makeSet([ "area", "base", "br", "col", "command", "embed" , "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "w br" ]); 2557 var voidElements = makeSet([ "area", "base", "br", "col", "command", "embed" , "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "w br" ]);
2597 var plaintextParents = makeSet([ "style", "script", "xmp", "iframe", "noembe d", "noframes", "plaintext", "noscript" ]); 2558 var plaintextParents = makeSet([ "style", "script", "xmp", "iframe", "noembe d", "noframes", "plaintext", "noscript" ]);
2598 var XHTML_NS = "http://www.w3.org/1999/xhtml";
2599 function needsSelfClosingSlash(node) {
2600 if (node.namespaceURI !== XHTML_NS) return true;
2601 var doctype = node.ownerDocument.doctype;
2602 return doctype && doctype.publicId && doctype.systemId;
2603 }
2604 function getOuterHTML(node, parentNode) { 2559 function getOuterHTML(node, parentNode) {
2605 switch (node.nodeType) { 2560 switch (node.nodeType) {
2606 case Node.ELEMENT_NODE: 2561 case Node.ELEMENT_NODE:
2607 var tagName = node.tagName.toLowerCase(); 2562 var tagName = node.tagName.toLowerCase();
2608 var s = "<" + tagName; 2563 var s = "<" + tagName;
2609 var attrs = node.attributes; 2564 var attrs = node.attributes;
2610 for (var i = 0, attr; attr = attrs[i]; i++) { 2565 for (var i = 0, attr; attr = attrs[i]; i++) {
2611 s += " " + attr.name + '="' + escapeAttr(attr.value) + '"'; 2566 s += " " + attr.name + '="' + escapeAttr(attr.value) + '"';
2612 } 2567 }
2613 if (voidElements[tagName]) { 2568 s += ">";
2614 if (needsSelfClosingSlash(node)) s += "/"; 2569 if (voidElements[tagName]) return s;
2615 return s + ">"; 2570 return s + getInnerHTML(node) + "</" + tagName + ">";
2616 }
2617 return s + ">" + getInnerHTML(node) + "</" + tagName + ">";
2618 2571
2619 case Node.TEXT_NODE: 2572 case Node.TEXT_NODE:
2620 var data = node.data; 2573 var data = node.data;
2621 if (parentNode && plaintextParents[parentNode.localName]) return data; 2574 if (parentNode && plaintextParents[parentNode.localName]) return data;
2622 return escapeData(data); 2575 return escapeData(data);
2623 2576
2624 case Node.COMMENT_NODE: 2577 case Node.COMMENT_NODE:
2625 return "<!--" + node.data + "-->"; 2578 return "<!--" + node.data + "-->";
2626 2579
2627 default: 2580 default:
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
2765 function methodRequiresRendering(name) { 2718 function methodRequiresRendering(name) {
2766 Object.defineProperty(HTMLElement.prototype, name, { 2719 Object.defineProperty(HTMLElement.prototype, name, {
2767 value: function() { 2720 value: function() {
2768 scope.renderAllPending(); 2721 scope.renderAllPending();
2769 return unsafeUnwrap(this)[name].apply(unsafeUnwrap(this), arguments); 2722 return unsafeUnwrap(this)[name].apply(unsafeUnwrap(this), arguments);
2770 }, 2723 },
2771 configurable: true, 2724 configurable: true,
2772 enumerable: true 2725 enumerable: true
2773 }); 2726 });
2774 } 2727 }
2775 [ "focus", "getBoundingClientRect", "getClientRects", "scrollIntoView" ].for Each(methodRequiresRendering); 2728 [ "getBoundingClientRect", "getClientRects", "scrollIntoView" ].forEach(meth odRequiresRendering);
2776 registerWrapper(OriginalHTMLElement, HTMLElement, document.createElement("b" )); 2729 registerWrapper(OriginalHTMLElement, HTMLElement, document.createElement("b" ));
2777 scope.wrappers.HTMLElement = HTMLElement; 2730 scope.wrappers.HTMLElement = HTMLElement;
2778 scope.getInnerHTML = getInnerHTML; 2731 scope.getInnerHTML = getInnerHTML;
2779 scope.setInnerHTML = setInnerHTML; 2732 scope.setInnerHTML = setInnerHTML;
2780 })(window.ShadowDOMPolyfill); 2733 })(window.ShadowDOMPolyfill);
2781 (function(scope) { 2734 (function(scope) {
2782 "use strict"; 2735 "use strict";
2783 var HTMLElement = scope.wrappers.HTMLElement; 2736 var HTMLElement = scope.wrappers.HTMLElement;
2784 var mixin = scope.mixin; 2737 var mixin = scope.mixin;
2785 var registerWrapper = scope.registerWrapper; 2738 var registerWrapper = scope.registerWrapper;
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
3172 HTMLElement.call(this, node); 3125 HTMLElement.call(this, node);
3173 } 3126 }
3174 HTMLUnknownElement.prototype = Object.create(HTMLElement.prototype); 3127 HTMLUnknownElement.prototype = Object.create(HTMLElement.prototype);
3175 registerWrapper(OriginalHTMLUnknownElement, HTMLUnknownElement); 3128 registerWrapper(OriginalHTMLUnknownElement, HTMLUnknownElement);
3176 scope.wrappers.HTMLUnknownElement = HTMLUnknownElement; 3129 scope.wrappers.HTMLUnknownElement = HTMLUnknownElement;
3177 })(window.ShadowDOMPolyfill); 3130 })(window.ShadowDOMPolyfill);
3178 (function(scope) { 3131 (function(scope) {
3179 "use strict"; 3132 "use strict";
3180 var Element = scope.wrappers.Element; 3133 var Element = scope.wrappers.Element;
3181 var HTMLElement = scope.wrappers.HTMLElement; 3134 var HTMLElement = scope.wrappers.HTMLElement;
3182 var registerWrapper = scope.registerWrapper; 3135 var registerObject = scope.registerObject;
3183 var defineWrapGetter = scope.defineWrapGetter; 3136 var defineWrapGetter = scope.defineWrapGetter;
3184 var unsafeUnwrap = scope.unsafeUnwrap;
3185 var wrap = scope.wrap;
3186 var mixin = scope.mixin;
3187 var SVG_NS = "http://www.w3.org/2000/svg"; 3137 var SVG_NS = "http://www.w3.org/2000/svg";
3188 var OriginalSVGElement = window.SVGElement;
3189 var svgTitleElement = document.createElementNS(SVG_NS, "title"); 3138 var svgTitleElement = document.createElementNS(SVG_NS, "title");
3139 var SVGTitleElement = registerObject(svgTitleElement);
3140 var SVGElement = Object.getPrototypeOf(SVGTitleElement.prototype).constructo r;
3190 if (!("classList" in svgTitleElement)) { 3141 if (!("classList" in svgTitleElement)) {
3191 var descr = Object.getOwnPropertyDescriptor(Element.prototype, "classList" ); 3142 var descr = Object.getOwnPropertyDescriptor(Element.prototype, "classList" );
3192 Object.defineProperty(HTMLElement.prototype, "classList", descr); 3143 Object.defineProperty(HTMLElement.prototype, "classList", descr);
3193 delete Element.prototype.classList; 3144 delete Element.prototype.classList;
3194 } 3145 }
3195 function SVGElement(node) { 3146 defineWrapGetter(SVGElement, "ownerSVGElement");
3196 Element.call(this, node);
3197 }
3198 SVGElement.prototype = Object.create(Element.prototype);
3199 mixin(SVGElement.prototype, {
3200 get ownerSVGElement() {
3201 return wrap(unsafeUnwrap(this).ownerSVGElement);
3202 }
3203 });
3204 registerWrapper(OriginalSVGElement, SVGElement, document.createElementNS(SVG _NS, "title"));
3205 scope.wrappers.SVGElement = SVGElement; 3147 scope.wrappers.SVGElement = SVGElement;
3206 })(window.ShadowDOMPolyfill); 3148 })(window.ShadowDOMPolyfill);
3207 (function(scope) { 3149 (function(scope) {
3208 "use strict"; 3150 "use strict";
3209 var mixin = scope.mixin; 3151 var mixin = scope.mixin;
3210 var registerWrapper = scope.registerWrapper; 3152 var registerWrapper = scope.registerWrapper;
3211 var unwrap = scope.unwrap; 3153 var unwrap = scope.unwrap;
3212 var wrap = scope.wrap; 3154 var wrap = scope.wrap;
3213 var OriginalSVGUseElement = window.SVGUseElement; 3155 var OriginalSVGUseElement = window.SVGUseElement;
3214 var SVG_NS = "http://www.w3.org/2000/svg"; 3156 var SVG_NS = "http://www.w3.org/2000/svg";
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
3300 createPattern: function() { 3242 createPattern: function() {
3301 arguments[0] = unwrap(arguments[0]); 3243 arguments[0] = unwrap(arguments[0]);
3302 return unsafeUnwrap(this).createPattern.apply(unsafeUnwrap(this), argume nts); 3244 return unsafeUnwrap(this).createPattern.apply(unsafeUnwrap(this), argume nts);
3303 } 3245 }
3304 }); 3246 });
3305 registerWrapper(OriginalCanvasRenderingContext2D, CanvasRenderingContext2D, document.createElement("canvas").getContext("2d")); 3247 registerWrapper(OriginalCanvasRenderingContext2D, CanvasRenderingContext2D, document.createElement("canvas").getContext("2d"));
3306 scope.wrappers.CanvasRenderingContext2D = CanvasRenderingContext2D; 3248 scope.wrappers.CanvasRenderingContext2D = CanvasRenderingContext2D;
3307 })(window.ShadowDOMPolyfill); 3249 })(window.ShadowDOMPolyfill);
3308 (function(scope) { 3250 (function(scope) {
3309 "use strict"; 3251 "use strict";
3310 var addForwardingProperties = scope.addForwardingProperties;
3311 var mixin = scope.mixin; 3252 var mixin = scope.mixin;
3312 var registerWrapper = scope.registerWrapper; 3253 var registerWrapper = scope.registerWrapper;
3313 var setWrapper = scope.setWrapper; 3254 var setWrapper = scope.setWrapper;
3314 var unsafeUnwrap = scope.unsafeUnwrap; 3255 var unsafeUnwrap = scope.unsafeUnwrap;
3315 var unwrapIfNeeded = scope.unwrapIfNeeded; 3256 var unwrapIfNeeded = scope.unwrapIfNeeded;
3316 var wrap = scope.wrap; 3257 var wrap = scope.wrap;
3317 var OriginalWebGLRenderingContext = window.WebGLRenderingContext; 3258 var OriginalWebGLRenderingContext = window.WebGLRenderingContext;
3318 if (!OriginalWebGLRenderingContext) return; 3259 if (!OriginalWebGLRenderingContext) return;
3319 function WebGLRenderingContext(impl) { 3260 function WebGLRenderingContext(impl) {
3320 setWrapper(impl, this); 3261 setWrapper(impl, this);
3321 } 3262 }
3322 mixin(WebGLRenderingContext.prototype, { 3263 mixin(WebGLRenderingContext.prototype, {
3323 get canvas() { 3264 get canvas() {
3324 return wrap(unsafeUnwrap(this).canvas); 3265 return wrap(unsafeUnwrap(this).canvas);
3325 }, 3266 },
3326 texImage2D: function() { 3267 texImage2D: function() {
3327 arguments[5] = unwrapIfNeeded(arguments[5]); 3268 arguments[5] = unwrapIfNeeded(arguments[5]);
3328 unsafeUnwrap(this).texImage2D.apply(unsafeUnwrap(this), arguments); 3269 unsafeUnwrap(this).texImage2D.apply(unsafeUnwrap(this), arguments);
3329 }, 3270 },
3330 texSubImage2D: function() { 3271 texSubImage2D: function() {
3331 arguments[6] = unwrapIfNeeded(arguments[6]); 3272 arguments[6] = unwrapIfNeeded(arguments[6]);
3332 unsafeUnwrap(this).texSubImage2D.apply(unsafeUnwrap(this), arguments); 3273 unsafeUnwrap(this).texSubImage2D.apply(unsafeUnwrap(this), arguments);
3333 } 3274 }
3334 }); 3275 });
3335 var OriginalWebGLRenderingContextBase = Object.getPrototypeOf(OriginalWebGLR enderingContext.prototype);
3336 if (OriginalWebGLRenderingContextBase !== Object.prototype) {
3337 addForwardingProperties(OriginalWebGLRenderingContextBase, WebGLRenderingC ontext.prototype);
3338 }
3339 var instanceProperties = /WebKit/.test(navigator.userAgent) ? { 3276 var instanceProperties = /WebKit/.test(navigator.userAgent) ? {
3340 drawingBufferHeight: null, 3277 drawingBufferHeight: null,
3341 drawingBufferWidth: null 3278 drawingBufferWidth: null
3342 } : {}; 3279 } : {};
3343 registerWrapper(OriginalWebGLRenderingContext, WebGLRenderingContext, instan ceProperties); 3280 registerWrapper(OriginalWebGLRenderingContext, WebGLRenderingContext, instan ceProperties);
3344 scope.wrappers.WebGLRenderingContext = WebGLRenderingContext; 3281 scope.wrappers.WebGLRenderingContext = WebGLRenderingContext;
3345 })(window.ShadowDOMPolyfill); 3282 })(window.ShadowDOMPolyfill);
3346 (function(scope) { 3283 (function(scope) {
3347 "use strict"; 3284 "use strict";
3348 var Node = scope.wrappers.Node;
3349 var GetElementsByInterface = scope.GetElementsByInterface; 3285 var GetElementsByInterface = scope.GetElementsByInterface;
3350 var NonElementParentNodeInterface = scope.NonElementParentNodeInterface;
3351 var ParentNodeInterface = scope.ParentNodeInterface; 3286 var ParentNodeInterface = scope.ParentNodeInterface;
3352 var SelectorsInterface = scope.SelectorsInterface; 3287 var SelectorsInterface = scope.SelectorsInterface;
3353 var mixin = scope.mixin; 3288 var mixin = scope.mixin;
3354 var registerObject = scope.registerObject; 3289 var registerObject = scope.registerObject;
3355 var registerWrapper = scope.registerWrapper; 3290 var DocumentFragment = registerObject(document.createDocumentFragment());
3356 var OriginalDocumentFragment = window.DocumentFragment;
3357 function DocumentFragment(node) {
3358 Node.call(this, node);
3359 }
3360 DocumentFragment.prototype = Object.create(Node.prototype);
3361 mixin(DocumentFragment.prototype, ParentNodeInterface); 3291 mixin(DocumentFragment.prototype, ParentNodeInterface);
3362 mixin(DocumentFragment.prototype, SelectorsInterface); 3292 mixin(DocumentFragment.prototype, SelectorsInterface);
3363 mixin(DocumentFragment.prototype, GetElementsByInterface); 3293 mixin(DocumentFragment.prototype, GetElementsByInterface);
3364 mixin(DocumentFragment.prototype, NonElementParentNodeInterface);
3365 registerWrapper(OriginalDocumentFragment, DocumentFragment, document.createD ocumentFragment());
3366 scope.wrappers.DocumentFragment = DocumentFragment;
3367 var Comment = registerObject(document.createComment("")); 3294 var Comment = registerObject(document.createComment(""));
3368 scope.wrappers.Comment = Comment; 3295 scope.wrappers.Comment = Comment;
3296 scope.wrappers.DocumentFragment = DocumentFragment;
3369 })(window.ShadowDOMPolyfill); 3297 })(window.ShadowDOMPolyfill);
3370 (function(scope) { 3298 (function(scope) {
3371 "use strict"; 3299 "use strict";
3372 var DocumentFragment = scope.wrappers.DocumentFragment; 3300 var DocumentFragment = scope.wrappers.DocumentFragment;
3373 var TreeScope = scope.TreeScope; 3301 var TreeScope = scope.TreeScope;
3374 var elementFromPoint = scope.elementFromPoint; 3302 var elementFromPoint = scope.elementFromPoint;
3375 var getInnerHTML = scope.getInnerHTML; 3303 var getInnerHTML = scope.getInnerHTML;
3376 var getTreeScope = scope.getTreeScope; 3304 var getTreeScope = scope.getTreeScope;
3377 var mixin = scope.mixin; 3305 var mixin = scope.mixin;
3378 var rewrap = scope.rewrap; 3306 var rewrap = scope.rewrap;
3379 var setInnerHTML = scope.setInnerHTML; 3307 var setInnerHTML = scope.setInnerHTML;
3380 var unsafeUnwrap = scope.unsafeUnwrap; 3308 var unsafeUnwrap = scope.unsafeUnwrap;
3381 var unwrap = scope.unwrap; 3309 var unwrap = scope.unwrap;
3382 var wrap = scope.wrap;
3383 var shadowHostTable = new WeakMap(); 3310 var shadowHostTable = new WeakMap();
3384 var nextOlderShadowTreeTable = new WeakMap(); 3311 var nextOlderShadowTreeTable = new WeakMap();
3312 var spaceCharRe = /[ \t\n\r\f]/;
3385 function ShadowRoot(hostWrapper) { 3313 function ShadowRoot(hostWrapper) {
3386 var node = unwrap(unsafeUnwrap(hostWrapper).ownerDocument.createDocumentFr agment()); 3314 var node = unwrap(unsafeUnwrap(hostWrapper).ownerDocument.createDocumentFr agment());
3387 DocumentFragment.call(this, node); 3315 DocumentFragment.call(this, node);
3388 rewrap(node, this); 3316 rewrap(node, this);
3389 var oldShadowRoot = hostWrapper.shadowRoot; 3317 var oldShadowRoot = hostWrapper.shadowRoot;
3390 nextOlderShadowTreeTable.set(this, oldShadowRoot); 3318 nextOlderShadowTreeTable.set(this, oldShadowRoot);
3391 this.treeScope_ = new TreeScope(this, getTreeScope(oldShadowRoot || hostWr apper)); 3319 this.treeScope_ = new TreeScope(this, getTreeScope(oldShadowRoot || hostWr apper));
3392 shadowHostTable.set(this, hostWrapper); 3320 shadowHostTable.set(this, hostWrapper);
3393 } 3321 }
3394 ShadowRoot.prototype = Object.create(DocumentFragment.prototype); 3322 ShadowRoot.prototype = Object.create(DocumentFragment.prototype);
(...skipping 11 matching lines...) Expand all
3406 }, 3334 },
3407 get host() { 3335 get host() {
3408 return shadowHostTable.get(this) || null; 3336 return shadowHostTable.get(this) || null;
3409 }, 3337 },
3410 invalidateShadowRenderer: function() { 3338 invalidateShadowRenderer: function() {
3411 return shadowHostTable.get(this).invalidateShadowRenderer(); 3339 return shadowHostTable.get(this).invalidateShadowRenderer();
3412 }, 3340 },
3413 elementFromPoint: function(x, y) { 3341 elementFromPoint: function(x, y) {
3414 return elementFromPoint(this, this.ownerDocument, x, y); 3342 return elementFromPoint(this, this.ownerDocument, x, y);
3415 }, 3343 },
3416 getSelection: function() { 3344 getElementById: function(id) {
3417 return document.getSelection(); 3345 if (spaceCharRe.test(id)) return null;
3418 }, 3346 return this.querySelector('[id="' + id + '"]');
3419 get activeElement() {
3420 var unwrappedActiveElement = unwrap(this).ownerDocument.activeElement;
3421 if (!unwrappedActiveElement || !unwrappedActiveElement.nodeType) return null;
3422 var activeElement = wrap(unwrappedActiveElement);
3423 while (!this.contains(activeElement)) {
3424 while (activeElement.parentNode) {
3425 activeElement = activeElement.parentNode;
3426 }
3427 if (activeElement.host) {
3428 activeElement = activeElement.host;
3429 } else {
3430 return null;
3431 }
3432 }
3433 return activeElement;
3434 } 3347 }
3435 }); 3348 });
3436 scope.wrappers.ShadowRoot = ShadowRoot; 3349 scope.wrappers.ShadowRoot = ShadowRoot;
3437 })(window.ShadowDOMPolyfill); 3350 })(window.ShadowDOMPolyfill);
3438 (function(scope) { 3351 (function(scope) {
3439 "use strict"; 3352 "use strict";
3440 var registerWrapper = scope.registerWrapper; 3353 var registerWrapper = scope.registerWrapper;
3441 var setWrapper = scope.setWrapper; 3354 var setWrapper = scope.setWrapper;
3442 var unsafeUnwrap = scope.unsafeUnwrap; 3355 var unsafeUnwrap = scope.unsafeUnwrap;
3443 var unwrap = scope.unwrap; 3356 var unwrap = scope.unwrap;
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
4011 containsNode: function(node, allowPartial) { 3924 containsNode: function(node, allowPartial) {
4012 return unsafeUnwrap(this).containsNode(unwrapIfNeeded(node), allowPartia l); 3925 return unsafeUnwrap(this).containsNode(unwrapIfNeeded(node), allowPartia l);
4013 }, 3926 },
4014 getRangeAt: function(index) { 3927 getRangeAt: function(index) {
4015 return wrap(unsafeUnwrap(this).getRangeAt(index)); 3928 return wrap(unsafeUnwrap(this).getRangeAt(index));
4016 }, 3929 },
4017 removeRange: function(range) { 3930 removeRange: function(range) {
4018 unsafeUnwrap(this).removeRange(unwrap(range)); 3931 unsafeUnwrap(this).removeRange(unwrap(range));
4019 }, 3932 },
4020 selectAllChildren: function(node) { 3933 selectAllChildren: function(node) {
4021 unsafeUnwrap(this).selectAllChildren(node instanceof ShadowRoot ? unsafe Unwrap(node.host) : unwrapIfNeeded(node)); 3934 unsafeUnwrap(this).selectAllChildren(unwrapIfNeeded(node));
4022 }, 3935 },
4023 toString: function() { 3936 toString: function() {
4024 return unsafeUnwrap(this).toString(); 3937 return unsafeUnwrap(this).toString();
4025 } 3938 }
4026 }; 3939 };
4027 if (OriginalSelection.prototype.extend) { 3940 if (OriginalSelection.prototype.extend) {
4028 Selection.prototype.extend = function(node, offset) { 3941 Selection.prototype.extend = function(node, offset) {
4029 unsafeUnwrap(this).extend(unwrapIfNeeded(node), offset); 3942 unsafeUnwrap(this).extend(unwrapIfNeeded(node), offset);
4030 }; 3943 };
4031 } 3944 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
4076 } 3989 }
4077 }; 3990 };
4078 registerWrapper(OriginalTreeWalker, TreeWalker); 3991 registerWrapper(OriginalTreeWalker, TreeWalker);
4079 scope.wrappers.TreeWalker = TreeWalker; 3992 scope.wrappers.TreeWalker = TreeWalker;
4080 })(window.ShadowDOMPolyfill); 3993 })(window.ShadowDOMPolyfill);
4081 (function(scope) { 3994 (function(scope) {
4082 "use strict"; 3995 "use strict";
4083 var GetElementsByInterface = scope.GetElementsByInterface; 3996 var GetElementsByInterface = scope.GetElementsByInterface;
4084 var Node = scope.wrappers.Node; 3997 var Node = scope.wrappers.Node;
4085 var ParentNodeInterface = scope.ParentNodeInterface; 3998 var ParentNodeInterface = scope.ParentNodeInterface;
4086 var NonElementParentNodeInterface = scope.NonElementParentNodeInterface;
4087 var Selection = scope.wrappers.Selection; 3999 var Selection = scope.wrappers.Selection;
4088 var SelectorsInterface = scope.SelectorsInterface; 4000 var SelectorsInterface = scope.SelectorsInterface;
4089 var ShadowRoot = scope.wrappers.ShadowRoot; 4001 var ShadowRoot = scope.wrappers.ShadowRoot;
4090 var TreeScope = scope.TreeScope; 4002 var TreeScope = scope.TreeScope;
4091 var cloneNode = scope.cloneNode; 4003 var cloneNode = scope.cloneNode;
4092 var defineGetter = scope.defineGetter;
4093 var defineWrapGetter = scope.defineWrapGetter; 4004 var defineWrapGetter = scope.defineWrapGetter;
4094 var elementFromPoint = scope.elementFromPoint; 4005 var elementFromPoint = scope.elementFromPoint;
4095 var forwardMethodsToWrapper = scope.forwardMethodsToWrapper; 4006 var forwardMethodsToWrapper = scope.forwardMethodsToWrapper;
4096 var matchesNames = scope.matchesNames; 4007 var matchesNames = scope.matchesNames;
4097 var mixin = scope.mixin; 4008 var mixin = scope.mixin;
4098 var registerWrapper = scope.registerWrapper; 4009 var registerWrapper = scope.registerWrapper;
4099 var renderAllPending = scope.renderAllPending; 4010 var renderAllPending = scope.renderAllPending;
4100 var rewrap = scope.rewrap; 4011 var rewrap = scope.rewrap;
4101 var setWrapper = scope.setWrapper; 4012 var setWrapper = scope.setWrapper;
4102 var unsafeUnwrap = scope.unsafeUnwrap; 4013 var unsafeUnwrap = scope.unsafeUnwrap;
4103 var unwrap = scope.unwrap; 4014 var unwrap = scope.unwrap;
4104 var wrap = scope.wrap; 4015 var wrap = scope.wrap;
4105 var wrapEventTargetMethods = scope.wrapEventTargetMethods; 4016 var wrapEventTargetMethods = scope.wrapEventTargetMethods;
4106 var wrapNodeList = scope.wrapNodeList; 4017 var wrapNodeList = scope.wrapNodeList;
4107 var implementationTable = new WeakMap(); 4018 var implementationTable = new WeakMap();
4108 function Document(node) { 4019 function Document(node) {
4109 Node.call(this, node); 4020 Node.call(this, node);
4110 this.treeScope_ = new TreeScope(this, null); 4021 this.treeScope_ = new TreeScope(this, null);
4111 } 4022 }
4112 Document.prototype = Object.create(Node.prototype); 4023 Document.prototype = Object.create(Node.prototype);
4113 defineWrapGetter(Document, "documentElement"); 4024 defineWrapGetter(Document, "documentElement");
4114 defineWrapGetter(Document, "body"); 4025 defineWrapGetter(Document, "body");
4115 defineWrapGetter(Document, "head"); 4026 defineWrapGetter(Document, "head");
4116 defineGetter(Document, "activeElement", function() {
4117 var unwrappedActiveElement = unwrap(this).activeElement;
4118 if (!unwrappedActiveElement || !unwrappedActiveElement.nodeType) return nu ll;
4119 var activeElement = wrap(unwrappedActiveElement);
4120 while (!this.contains(activeElement)) {
4121 while (activeElement.parentNode) {
4122 activeElement = activeElement.parentNode;
4123 }
4124 if (activeElement.host) {
4125 activeElement = activeElement.host;
4126 } else {
4127 return null;
4128 }
4129 }
4130 return activeElement;
4131 });
4132 function wrapMethod(name) { 4027 function wrapMethod(name) {
4133 var original = document[name]; 4028 var original = document[name];
4134 Document.prototype[name] = function() { 4029 Document.prototype[name] = function() {
4135 return wrap(original.apply(unsafeUnwrap(this), arguments)); 4030 return wrap(original.apply(unsafeUnwrap(this), arguments));
4136 }; 4031 };
4137 } 4032 }
4138 [ "createComment", "createDocumentFragment", "createElement", "createElement NS", "createEvent", "createEventNS", "createRange", "createTextNode" ].forEach(w rapMethod); 4033 [ "createComment", "createDocumentFragment", "createElement", "createElement NS", "createEvent", "createEventNS", "createRange", "createTextNode", "getElemen tById" ].forEach(wrapMethod);
4139 var originalAdoptNode = document.adoptNode; 4034 var originalAdoptNode = document.adoptNode;
4140 function adoptNodeNoRemove(node, doc) { 4035 function adoptNodeNoRemove(node, doc) {
4141 originalAdoptNode.call(unsafeUnwrap(doc), unwrap(node)); 4036 originalAdoptNode.call(unsafeUnwrap(doc), unwrap(node));
4142 adoptSubtree(node, doc); 4037 adoptSubtree(node, doc);
4143 } 4038 }
4144 function adoptSubtree(node, doc) { 4039 function adoptSubtree(node, doc) {
4145 if (node.shadowRoot) doc.adoptNode(node.shadowRoot); 4040 if (node.shadowRoot) doc.adoptNode(node.shadowRoot);
4146 if (node instanceof ShadowRoot) adoptOlderShadowRoots(node, doc); 4041 if (node instanceof ShadowRoot) adoptOlderShadowRoots(node, doc);
4147 for (var child = node.firstChild; child; child = child.nextSibling) { 4042 for (var child = node.firstChild; child; child = child.nextSibling) {
4148 adoptSubtree(child, doc); 4043 adoptSubtree(child, doc);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
4252 return CustomElementConstructor; 4147 return CustomElementConstructor;
4253 }; 4148 };
4254 forwardMethodsToWrapper([ window.HTMLDocument || window.Document ], [ "reg isterElement" ]); 4149 forwardMethodsToWrapper([ window.HTMLDocument || window.Document ], [ "reg isterElement" ]);
4255 } 4150 }
4256 forwardMethodsToWrapper([ window.HTMLBodyElement, window.HTMLDocument || win dow.Document, window.HTMLHeadElement, window.HTMLHtmlElement ], [ "appendChild", "compareDocumentPosition", "contains", "getElementsByClassName", "getElementsBy TagName", "getElementsByTagNameNS", "insertBefore", "querySelector", "querySelec torAll", "removeChild", "replaceChild" ]); 4151 forwardMethodsToWrapper([ window.HTMLBodyElement, window.HTMLDocument || win dow.Document, window.HTMLHeadElement, window.HTMLHtmlElement ], [ "appendChild", "compareDocumentPosition", "contains", "getElementsByClassName", "getElementsBy TagName", "getElementsByTagNameNS", "insertBefore", "querySelector", "querySelec torAll", "removeChild", "replaceChild" ]);
4257 forwardMethodsToWrapper([ window.HTMLBodyElement, window.HTMLHeadElement, wi ndow.HTMLHtmlElement ], matchesNames); 4152 forwardMethodsToWrapper([ window.HTMLBodyElement, window.HTMLHeadElement, wi ndow.HTMLHtmlElement ], matchesNames);
4258 forwardMethodsToWrapper([ window.HTMLDocument || window.Document ], [ "adopt Node", "importNode", "contains", "createComment", "createDocumentFragment", "cre ateElement", "createElementNS", "createEvent", "createEventNS", "createRange", " createTextNode", "createTreeWalker", "elementFromPoint", "getElementById", "getE lementsByName", "getSelection" ]); 4153 forwardMethodsToWrapper([ window.HTMLDocument || window.Document ], [ "adopt Node", "importNode", "contains", "createComment", "createDocumentFragment", "cre ateElement", "createElementNS", "createEvent", "createEventNS", "createRange", " createTextNode", "createTreeWalker", "elementFromPoint", "getElementById", "getE lementsByName", "getSelection" ]);
4259 mixin(Document.prototype, GetElementsByInterface); 4154 mixin(Document.prototype, GetElementsByInterface);
4260 mixin(Document.prototype, ParentNodeInterface); 4155 mixin(Document.prototype, ParentNodeInterface);
4261 mixin(Document.prototype, SelectorsInterface); 4156 mixin(Document.prototype, SelectorsInterface);
4262 mixin(Document.prototype, NonElementParentNodeInterface);
4263 mixin(Document.prototype, { 4157 mixin(Document.prototype, {
4264 get implementation() { 4158 get implementation() {
4265 var implementation = implementationTable.get(this); 4159 var implementation = implementationTable.get(this);
4266 if (implementation) return implementation; 4160 if (implementation) return implementation;
4267 implementation = new DOMImplementation(unwrap(this).implementation); 4161 implementation = new DOMImplementation(unwrap(this).implementation);
4268 implementationTable.set(this, implementation); 4162 implementationTable.set(this, implementation);
4269 return implementation; 4163 return implementation;
4270 }, 4164 },
4271 get defaultView() { 4165 get defaultView() {
4272 return wrap(unwrap(this).defaultView); 4166 return wrap(unwrap(this).defaultView);
4273 } 4167 }
4274 }); 4168 });
4275 registerWrapper(window.Document, Document, document.implementation.createHTM LDocument("")); 4169 registerWrapper(window.Document, Document, document.implementation.createHTM LDocument(""));
4276 if (window.HTMLDocument) registerWrapper(window.HTMLDocument, Document); 4170 if (window.HTMLDocument) registerWrapper(window.HTMLDocument, Document);
4277 wrapEventTargetMethods([ window.HTMLBodyElement, window.HTMLDocument || wind ow.Document, window.HTMLHeadElement ]); 4171 wrapEventTargetMethods([ window.HTMLBodyElement, window.HTMLDocument || wind ow.Document, window.HTMLHeadElement ]);
4278 function DOMImplementation(impl) { 4172 function DOMImplementation(impl) {
4279 setWrapper(impl, this); 4173 setWrapper(impl, this);
4280 } 4174 }
4281 var originalCreateDocument = document.implementation.createDocument;
4282 DOMImplementation.prototype.createDocument = function() {
4283 arguments[2] = unwrap(arguments[2]);
4284 return wrap(originalCreateDocument.apply(unsafeUnwrap(this), arguments));
4285 };
4286 function wrapImplMethod(constructor, name) { 4175 function wrapImplMethod(constructor, name) {
4287 var original = document.implementation[name]; 4176 var original = document.implementation[name];
4288 constructor.prototype[name] = function() { 4177 constructor.prototype[name] = function() {
4289 return wrap(original.apply(unsafeUnwrap(this), arguments)); 4178 return wrap(original.apply(unsafeUnwrap(this), arguments));
4290 }; 4179 };
4291 } 4180 }
4292 function forwardImplMethod(constructor, name) { 4181 function forwardImplMethod(constructor, name) {
4293 var original = document.implementation[name]; 4182 var original = document.implementation[name];
4294 constructor.prototype[name] = function() { 4183 constructor.prototype[name] = function() {
4295 return original.apply(unsafeUnwrap(this), arguments); 4184 return original.apply(unsafeUnwrap(this), arguments);
4296 }; 4185 };
4297 } 4186 }
4298 wrapImplMethod(DOMImplementation, "createDocumentType"); 4187 wrapImplMethod(DOMImplementation, "createDocumentType");
4188 wrapImplMethod(DOMImplementation, "createDocument");
4299 wrapImplMethod(DOMImplementation, "createHTMLDocument"); 4189 wrapImplMethod(DOMImplementation, "createHTMLDocument");
4300 forwardImplMethod(DOMImplementation, "hasFeature"); 4190 forwardImplMethod(DOMImplementation, "hasFeature");
4301 registerWrapper(window.DOMImplementation, DOMImplementation); 4191 registerWrapper(window.DOMImplementation, DOMImplementation);
4302 forwardMethodsToWrapper([ window.DOMImplementation ], [ "createDocument", "c reateDocumentType", "createHTMLDocument", "hasFeature" ]); 4192 forwardMethodsToWrapper([ window.DOMImplementation ], [ "createDocumentType" , "createDocument", "createHTMLDocument", "hasFeature" ]);
4303 scope.adoptNodeNoRemove = adoptNodeNoRemove; 4193 scope.adoptNodeNoRemove = adoptNodeNoRemove;
4304 scope.wrappers.DOMImplementation = DOMImplementation; 4194 scope.wrappers.DOMImplementation = DOMImplementation;
4305 scope.wrappers.Document = Document; 4195 scope.wrappers.Document = Document;
4306 })(window.ShadowDOMPolyfill); 4196 })(window.ShadowDOMPolyfill);
4307 (function(scope) { 4197 (function(scope) {
4308 "use strict"; 4198 "use strict";
4309 var EventTarget = scope.wrappers.EventTarget; 4199 var EventTarget = scope.wrappers.EventTarget;
4310 var Selection = scope.wrappers.Selection; 4200 var Selection = scope.wrappers.Selection;
4311 var mixin = scope.mixin; 4201 var mixin = scope.mixin;
4312 var registerWrapper = scope.registerWrapper; 4202 var registerWrapper = scope.registerWrapper;
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
4767 } 4657 }
4768 }, 4658 },
4769 addCssToDocument: function(cssText, name) { 4659 addCssToDocument: function(cssText, name) {
4770 if (cssText.match("@import")) { 4660 if (cssText.match("@import")) {
4771 addOwnSheet(cssText, name); 4661 addOwnSheet(cssText, name);
4772 } else { 4662 } else {
4773 addCssToDocument(cssText); 4663 addCssToDocument(cssText);
4774 } 4664 }
4775 } 4665 }
4776 }; 4666 };
4777 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-r ule)[^}]*(content\:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim, cssCommentUnscopedRuleRe = /\/\*\s@polyfill-unscoped-rule([^*]*\*+([^\/*][^*]*\*+)*)\//gim, cssContentUn scopedRuleRe = /(polyfill-unscoped-rule)[^}]*(content\:[\s]*['"](.*?)['"])[;\s]* [^}]*}/gim, cssPseudoRe = /::(x-[^\s{,(]*)/gim, cssPartRe = /::part\(([^)]*)\)/g im, polyfillHost = "-shadowcsshost", polyfillHostContext = "-shadowcsscontext", parenSuffix = ")(?:\\((" + "(?:\\([^)(]*\\)|[^)(]*)+?" + ")\\))?([^,{]*)"; 4667 var selectorRe = /([^{]*)({[\s\S]*?})/gim, cssCommentRe = /\/\*[^*]*\*+([^/* ][^*]*\*+)*\//gim, cssCommentNextSelectorRe = /\/\*\s*@polyfill ([^*]*\*+([^/*][ ^*]*\*+)*\/)([^{]*?){/gim, cssContentNextSelectorRe = /polyfill-next-selector[^} ]*content\:[\s]*?['"](.*?)['"][;\s]*}([^{]*?){/gim, cssCommentRuleRe = /\/\*\s@p olyfill-rule([^*]*\*+([^/*][^*]*\*+)*)\//gim, cssContentRuleRe = /(polyfill-rule )[^}]*(content\:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim, cssCommentUnscopedRuleRe = /\/\*\s@polyfill-unscoped-rule([^*]*\*+([^/*][^*]*\*+)*)\//gim, cssContentUnscop edRuleRe = /(polyfill-unscoped-rule)[^}]*(content\:[\s]*['"](.*?)['"])[;\s]*[^}] *}/gim, cssPseudoRe = /::(x-[^\s{,(]*)/gim, cssPartRe = /::part\(([^)]*)\)/gim, polyfillHost = "-shadowcsshost", polyfillHostContext = "-shadowcsscontext", pare nSuffix = ")(?:\\((" + "(?:\\([^)(]*\\)|[^)(]*)+?" + ")\\))?([^,{]*)";
4778 var cssColonHostRe = new RegExp("(" + polyfillHost + parenSuffix, "gim"), cs sColonHostContextRe = new RegExp("(" + polyfillHostContext + parenSuffix, "gim") , selectorReSuffix = "([>\\s~+[.,{:][\\s\\S]*)?$", colonHostRe = /\:host/gim, co lonHostContextRe = /\:host-context/gim, polyfillHostNoCombinator = polyfillHost + "-no-combinator", polyfillHostRe = new RegExp(polyfillHost, "gim"), polyfillHo stContextRe = new RegExp(polyfillHostContext, "gim"), shadowDOMSelectorsRe = [ / >>>/g, /::shadow/g, /::content/g, /\/deep\//g, /\/shadow\//g, /\/shadow-deep\//g , /\^\^/g, /\^/g ]; 4668 var cssColonHostRe = new RegExp("(" + polyfillHost + parenSuffix, "gim"), cs sColonHostContextRe = new RegExp("(" + polyfillHostContext + parenSuffix, "gim") , selectorReSuffix = "([>\\s~+[.,{:][\\s\\S]*)?$", colonHostRe = /\:host/gim, co lonHostContextRe = /\:host-context/gim, polyfillHostNoCombinator = polyfillHost + "-no-combinator", polyfillHostRe = new RegExp(polyfillHost, "gim"), polyfillHo stContextRe = new RegExp(polyfillHostContext, "gim"), shadowDOMSelectorsRe = [ / >>>/g, /::shadow/g, /::content/g, /\/deep\//g, /\/shadow\//g, /\/shadow-deep\//g , /\^\^/g, /\^/g ];
4779 function stylesToCssText(styles, preserveComments) { 4669 function stylesToCssText(styles, preserveComments) {
4780 var cssText = ""; 4670 var cssText = "";
4781 Array.prototype.forEach.call(styles, function(s) { 4671 Array.prototype.forEach.call(styles, function(s) {
4782 cssText += s.textContent + "\n\n"; 4672 cssText += s.textContent + "\n\n";
4783 }); 4673 });
4784 if (!preserveComments) { 4674 if (!preserveComments) {
4785 cssText = cssText.replace(cssCommentRe, ""); 4675 cssText = cssText.replace(cssCommentRe, "");
4786 } 4676 }
4787 return cssText; 4677 return cssText;
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
5042 } else if (EOF == c) { 4932 } else if (EOF == c) {
5043 break loop; 4933 break loop;
5044 } else { 4934 } else {
5045 err("Code point not allowed in scheme: " + c); 4935 err("Code point not allowed in scheme: " + c);
5046 break loop; 4936 break loop;
5047 } 4937 }
5048 break; 4938 break;
5049 4939
5050 case "scheme data": 4940 case "scheme data":
5051 if ("?" == c) { 4941 if ("?" == c) {
5052 this._query = "?"; 4942 query = "?";
5053 state = "query"; 4943 state = "query";
5054 } else if ("#" == c) { 4944 } else if ("#" == c) {
5055 this._fragment = "#"; 4945 this._fragment = "#";
5056 state = "fragment"; 4946 state = "fragment";
5057 } else { 4947 } else {
5058 if (EOF != c && " " != c && "\n" != c && "\r" != c) { 4948 if (EOF != c && " " != c && "\n" != c && "\r" != c) {
5059 this._schemeData += percentEscape(c); 4949 this._schemeData += percentEscape(c);
5060 } 4950 }
5061 } 4951 }
5062 break; 4952 break;
(...skipping 19 matching lines...) Expand all
5082 break; 4972 break;
5083 4973
5084 case "relative": 4974 case "relative":
5085 this._isRelative = true; 4975 this._isRelative = true;
5086 if ("file" != this._scheme) this._scheme = base._scheme; 4976 if ("file" != this._scheme) this._scheme = base._scheme;
5087 if (EOF == c) { 4977 if (EOF == c) {
5088 this._host = base._host; 4978 this._host = base._host;
5089 this._port = base._port; 4979 this._port = base._port;
5090 this._path = base._path.slice(); 4980 this._path = base._path.slice();
5091 this._query = base._query; 4981 this._query = base._query;
5092 this._username = base._username;
5093 this._password = base._password;
5094 break loop; 4982 break loop;
5095 } else if ("/" == c || "\\" == c) { 4983 } else if ("/" == c || "\\" == c) {
5096 if ("\\" == c) err("\\ is an invalid code point."); 4984 if ("\\" == c) err("\\ is an invalid code point.");
5097 state = "relative slash"; 4985 state = "relative slash";
5098 } else if ("?" == c) { 4986 } else if ("?" == c) {
5099 this._host = base._host; 4987 this._host = base._host;
5100 this._port = base._port; 4988 this._port = base._port;
5101 this._path = base._path.slice(); 4989 this._path = base._path.slice();
5102 this._query = "?"; 4990 this._query = "?";
5103 this._username = base._username;
5104 this._password = base._password;
5105 state = "query"; 4991 state = "query";
5106 } else if ("#" == c) { 4992 } else if ("#" == c) {
5107 this._host = base._host; 4993 this._host = base._host;
5108 this._port = base._port; 4994 this._port = base._port;
5109 this._path = base._path.slice(); 4995 this._path = base._path.slice();
5110 this._query = base._query; 4996 this._query = base._query;
5111 this._fragment = "#"; 4997 this._fragment = "#";
5112 this._username = base._username;
5113 this._password = base._password;
5114 state = "fragment"; 4998 state = "fragment";
5115 } else { 4999 } else {
5116 var nextC = input[cursor + 1]; 5000 var nextC = input[cursor + 1];
5117 var nextNextC = input[cursor + 2]; 5001 var nextNextC = input[cursor + 2];
5118 if ("file" != this._scheme || !ALPHA.test(c) || nextC != ":" && nextC != "|" || EOF != nextNextC && "/" != nextNextC && "\\" != nextNextC && "?" != ne xtNextC && "#" != nextNextC) { 5002 if ("file" != this._scheme || !ALPHA.test(c) || nextC != ":" && nextC != "|" || EOF != nextNextC && "/" != nextNextC && "\\" != nextNextC && "?" != ne xtNextC && "#" != nextNextC) {
5119 this._host = base._host; 5003 this._host = base._host;
5120 this._port = base._port; 5004 this._port = base._port;
5121 this._username = base._username;
5122 this._password = base._password;
5123 this._path = base._path.slice(); 5005 this._path = base._path.slice();
5124 this._path.pop(); 5006 this._path.pop();
5125 } 5007 }
5126 state = "relative path"; 5008 state = "relative path";
5127 continue; 5009 continue;
5128 } 5010 }
5129 break; 5011 break;
5130 5012
5131 case "relative slash": 5013 case "relative slash":
5132 if ("/" == c || "\\" == c) { 5014 if ("/" == c || "\\" == c) {
5133 if ("\\" == c) { 5015 if ("\\" == c) {
5134 err("\\ is an invalid code point."); 5016 err("\\ is an invalid code point.");
5135 } 5017 }
5136 if ("file" == this._scheme) { 5018 if ("file" == this._scheme) {
5137 state = "file host"; 5019 state = "file host";
5138 } else { 5020 } else {
5139 state = "authority ignore slashes"; 5021 state = "authority ignore slashes";
5140 } 5022 }
5141 } else { 5023 } else {
5142 if ("file" != this._scheme) { 5024 if ("file" != this._scheme) {
5143 this._host = base._host; 5025 this._host = base._host;
5144 this._port = base._port; 5026 this._port = base._port;
5145 this._username = base._username;
5146 this._password = base._password;
5147 } 5027 }
5148 state = "relative path"; 5028 state = "relative path";
5149 continue; 5029 continue;
5150 } 5030 }
5151 break; 5031 break;
5152 5032
5153 case "authority first slash": 5033 case "authority first slash":
5154 if ("/" == c) { 5034 if ("/" == c) {
5155 state = "authority second slash"; 5035 state = "authority second slash";
5156 } else { 5036 } else {
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
5452 var OriginalURL = scope.URL; 5332 var OriginalURL = scope.URL;
5453 if (OriginalURL) { 5333 if (OriginalURL) {
5454 jURL.createObjectURL = function(blob) { 5334 jURL.createObjectURL = function(blob) {
5455 return OriginalURL.createObjectURL.apply(OriginalURL, arguments); 5335 return OriginalURL.createObjectURL.apply(OriginalURL, arguments);
5456 }; 5336 };
5457 jURL.revokeObjectURL = function(url) { 5337 jURL.revokeObjectURL = function(url) {
5458 OriginalURL.revokeObjectURL(url); 5338 OriginalURL.revokeObjectURL(url);
5459 }; 5339 };
5460 } 5340 }
5461 scope.URL = jURL; 5341 scope.URL = jURL;
5462 })(self); 5342 })(this);
5463 5343
5464 (function(global) { 5344 (function(global) {
5465 if (global.JsMutationObserver) {
5466 return;
5467 }
5468 var registrationsTable = new WeakMap(); 5345 var registrationsTable = new WeakMap();
5469 var setImmediate; 5346 var setImmediate;
5470 if (/Trident|Edge/.test(navigator.userAgent)) { 5347 if (/Trident|Edge/.test(navigator.userAgent)) {
5471 setImmediate = setTimeout; 5348 setImmediate = setTimeout;
5472 } else if (window.setImmediate) { 5349 } else if (window.setImmediate) {
5473 setImmediate = window.setImmediate; 5350 setImmediate = window.setImmediate;
5474 } else { 5351 } else {
5475 var setImmediateQueue = []; 5352 var setImmediateQueue = [];
5476 var sentinel = String(Math.random()); 5353 var sentinel = String(Math.random());
5477 window.addEventListener("message", function(e) { 5354 window.addEventListener("message", function(e) {
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
5753 record.nextSibling = nextSibling; 5630 record.nextSibling = nextSibling;
5754 forEachAncestorAndObserverEnqueueRecord(e.relatedNode, function(options) { 5631 forEachAncestorAndObserverEnqueueRecord(e.relatedNode, function(options) {
5755 if (!options.childList) return; 5632 if (!options.childList) return;
5756 return record; 5633 return record;
5757 }); 5634 });
5758 } 5635 }
5759 clearRecords(); 5636 clearRecords();
5760 } 5637 }
5761 }; 5638 };
5762 global.JsMutationObserver = JsMutationObserver; 5639 global.JsMutationObserver = JsMutationObserver;
5763 if (!global.MutationObserver) { 5640 if (!global.MutationObserver) global.MutationObserver = JsMutationObserver;
5764 global.MutationObserver = JsMutationObserver; 5641 })(this);
5765 JsMutationObserver._isPolyfilled = true;
5766 }
5767 })(self);
5768
5769 (function(scope) {
5770 "use strict";
5771 if (!window.performance) {
5772 var start = Date.now();
5773 window.performance = {
5774 now: function() {
5775 return Date.now() - start;
5776 }
5777 };
5778 }
5779 if (!window.requestAnimationFrame) {
5780 window.requestAnimationFrame = function() {
5781 var nativeRaf = window.webkitRequestAnimationFrame || window.mozRequestAni mationFrame;
5782 return nativeRaf ? function(callback) {
5783 return nativeRaf(function() {
5784 callback(performance.now());
5785 });
5786 } : function(callback) {
5787 return window.setTimeout(callback, 1e3 / 60);
5788 };
5789 }();
5790 }
5791 if (!window.cancelAnimationFrame) {
5792 window.cancelAnimationFrame = function() {
5793 return window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame || function(id) {
5794 clearTimeout(id);
5795 };
5796 }();
5797 }
5798 var workingDefaultPrevented = function() {
5799 var e = document.createEvent("Event");
5800 e.initEvent("foo", true, true);
5801 e.preventDefault();
5802 return e.defaultPrevented;
5803 }();
5804 if (!workingDefaultPrevented) {
5805 var origPreventDefault = Event.prototype.preventDefault;
5806 Event.prototype.preventDefault = function() {
5807 if (!this.cancelable) {
5808 return;
5809 }
5810 origPreventDefault.call(this);
5811 Object.defineProperty(this, "defaultPrevented", {
5812 get: function() {
5813 return true;
5814 },
5815 configurable: true
5816 });
5817 };
5818 }
5819 var isIE = /Trident/.test(navigator.userAgent);
5820 if (!window.CustomEvent || isIE && typeof window.CustomEvent !== "function") {
5821 window.CustomEvent = function(inType, params) {
5822 params = params || {};
5823 var e = document.createEvent("CustomEvent");
5824 e.initCustomEvent(inType, Boolean(params.bubbles), Boolean(params.cancelab le), params.detail);
5825 return e;
5826 };
5827 window.CustomEvent.prototype = window.Event.prototype;
5828 }
5829 if (!window.Event || isIE && typeof window.Event !== "function") {
5830 var origEvent = window.Event;
5831 window.Event = function(inType, params) {
5832 params = params || {};
5833 var e = document.createEvent("Event");
5834 e.initEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable));
5835 return e;
5836 };
5837 window.Event.prototype = origEvent.prototype;
5838 }
5839 })(window.WebComponents);
5840 5642
5841 window.HTMLImports = window.HTMLImports || { 5643 window.HTMLImports = window.HTMLImports || {
5842 flags: {} 5644 flags: {}
5843 }; 5645 };
5844 5646
5845 (function(scope) { 5647 (function(scope) {
5846 var IMPORT_LINK_TYPE = "import"; 5648 var IMPORT_LINK_TYPE = "import";
5847 var useNative = Boolean(IMPORT_LINK_TYPE in document.createElement("link")); 5649 var useNative = Boolean(IMPORT_LINK_TYPE in document.createElement("link"));
5848 var hasShadowDOMPolyfill = Boolean(window.ShadowDOMPolyfill); 5650 var hasShadowDOMPolyfill = Boolean(window.ShadowDOMPolyfill);
5849 var wrap = function(node) { 5651 var wrap = function(node) {
5850 return hasShadowDOMPolyfill ? window.ShadowDOMPolyfill.wrapIfNeeded(node) : node; 5652 return hasShadowDOMPolyfill ? ShadowDOMPolyfill.wrapIfNeeded(node) : node;
5851 }; 5653 };
5852 var rootDocument = wrap(document); 5654 var rootDocument = wrap(document);
5853 var currentScriptDescriptor = { 5655 var currentScriptDescriptor = {
5854 get: function() { 5656 get: function() {
5855 var script = window.HTMLImports.currentScript || document.currentScript || (document.readyState !== "complete" ? document.scripts[document.scripts.length - 1] : null); 5657 var script = HTMLImports.currentScript || document.currentScript || (docum ent.readyState !== "complete" ? document.scripts[document.scripts.length - 1] : null);
5856 return wrap(script); 5658 return wrap(script);
5857 }, 5659 },
5858 configurable: true 5660 configurable: true
5859 }; 5661 };
5860 Object.defineProperty(document, "_currentScript", currentScriptDescriptor); 5662 Object.defineProperty(document, "_currentScript", currentScriptDescriptor);
5861 Object.defineProperty(rootDocument, "_currentScript", currentScriptDescriptor) ; 5663 Object.defineProperty(rootDocument, "_currentScript", currentScriptDescriptor) ;
5862 var isIE = /Trident/.test(navigator.userAgent); 5664 var isIE = /Trident|Edge/.test(navigator.userAgent);
5863 function whenReady(callback, doc) { 5665 function whenReady(callback, doc) {
5864 doc = doc || rootDocument; 5666 doc = doc || rootDocument;
5865 whenDocumentReady(function() { 5667 whenDocumentReady(function() {
5866 watchImportsLoad(callback, doc); 5668 watchImportsLoad(callback, doc);
5867 }, doc); 5669 }, doc);
5868 } 5670 }
5869 var requiredReadyState = isIE ? "complete" : "interactive"; 5671 var requiredReadyState = isIE ? "complete" : "interactive";
5870 var READY_EVENT = "readystatechange"; 5672 var READY_EVENT = "readystatechange";
5871 function isDocumentReady(doc) { 5673 function isDocumentReady(doc) {
5872 return doc.readyState === "complete" || doc.readyState === requiredReadyStat e; 5674 return doc.readyState === "complete" || doc.readyState === requiredReadyStat e;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
5906 checkDone(); 5708 checkDone();
5907 } 5709 }
5908 function errorLoadingImport(e) { 5710 function errorLoadingImport(e) {
5909 errorImports.push(this); 5711 errorImports.push(this);
5910 parsedCount++; 5712 parsedCount++;
5911 checkDone(); 5713 checkDone();
5912 } 5714 }
5913 if (importCount) { 5715 if (importCount) {
5914 for (var i = 0, imp; i < importCount && (imp = imports[i]); i++) { 5716 for (var i = 0, imp; i < importCount && (imp = imports[i]); i++) {
5915 if (isImportLoaded(imp)) { 5717 if (isImportLoaded(imp)) {
5916 newImports.push(this);
5917 parsedCount++; 5718 parsedCount++;
5918 checkDone(); 5719 checkDone();
5919 } else { 5720 } else {
5920 imp.addEventListener("load", loadedImport); 5721 imp.addEventListener("load", loadedImport);
5921 imp.addEventListener("error", errorLoadingImport); 5722 imp.addEventListener("error", errorLoadingImport);
5922 } 5723 }
5923 } 5724 }
5924 } else { 5725 } else {
5925 checkDone(); 5726 checkDone();
5926 } 5727 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
5962 (function() { 5763 (function() {
5963 if (document.readyState === "loading") { 5764 if (document.readyState === "loading") {
5964 var imports = document.querySelectorAll("link[rel=import]"); 5765 var imports = document.querySelectorAll("link[rel=import]");
5965 for (var i = 0, l = imports.length, imp; i < l && (imp = imports[i]); i+ +) { 5766 for (var i = 0, l = imports.length, imp; i < l && (imp = imports[i]); i+ +) {
5966 handleImport(imp); 5767 handleImport(imp);
5967 } 5768 }
5968 } 5769 }
5969 })(); 5770 })();
5970 } 5771 }
5971 whenReady(function(detail) { 5772 whenReady(function(detail) {
5972 window.HTMLImports.ready = true; 5773 HTMLImports.ready = true;
5973 window.HTMLImports.readyTime = new Date().getTime(); 5774 HTMLImports.readyTime = new Date().getTime();
5974 var evt = rootDocument.createEvent("CustomEvent"); 5775 var evt = rootDocument.createEvent("CustomEvent");
5975 evt.initCustomEvent("HTMLImportsLoaded", true, true, detail); 5776 evt.initCustomEvent("HTMLImportsLoaded", true, true, detail);
5976 rootDocument.dispatchEvent(evt); 5777 rootDocument.dispatchEvent(evt);
5977 }); 5778 });
5978 scope.IMPORT_LINK_TYPE = IMPORT_LINK_TYPE; 5779 scope.IMPORT_LINK_TYPE = IMPORT_LINK_TYPE;
5979 scope.useNative = useNative; 5780 scope.useNative = useNative;
5980 scope.rootDocument = rootDocument; 5781 scope.rootDocument = rootDocument;
5981 scope.whenReady = whenReady; 5782 scope.whenReady = whenReady;
5982 scope.isIE = isIE; 5783 scope.isIE = isIE;
5983 })(window.HTMLImports); 5784 })(HTMLImports);
5984 5785
5985 (function(scope) { 5786 (function(scope) {
5986 var modules = []; 5787 var modules = [];
5987 var addModule = function(module) { 5788 var addModule = function(module) {
5988 modules.push(module); 5789 modules.push(module);
5989 }; 5790 };
5990 var initializeModules = function() { 5791 var initializeModules = function() {
5991 modules.forEach(function(module) { 5792 modules.forEach(function(module) {
5992 module(scope); 5793 module(scope);
5993 }); 5794 });
5994 }; 5795 };
5995 scope.addModule = addModule; 5796 scope.addModule = addModule;
5996 scope.initializeModules = initializeModules; 5797 scope.initializeModules = initializeModules;
5997 })(window.HTMLImports); 5798 })(HTMLImports);
5998 5799
5999 window.HTMLImports.addModule(function(scope) { 5800 HTMLImports.addModule(function(scope) {
6000 var CSS_URL_REGEXP = /(url\()([^)]*)(\))/g; 5801 var CSS_URL_REGEXP = /(url\()([^)]*)(\))/g;
6001 var CSS_IMPORT_REGEXP = /(@import[\s]+(?!url\())([^;]*)(;)/g; 5802 var CSS_IMPORT_REGEXP = /(@import[\s]+(?!url\())([^;]*)(;)/g;
6002 var path = { 5803 var path = {
6003 resolveUrlsInStyle: function(style, linkUrl) { 5804 resolveUrlsInStyle: function(style, linkUrl) {
6004 var doc = style.ownerDocument; 5805 var doc = style.ownerDocument;
6005 var resolver = doc.createElement("a"); 5806 var resolver = doc.createElement("a");
6006 style.textContent = this.resolveUrlsInCssText(style.textContent, linkUrl, resolver); 5807 style.textContent = this.resolveUrlsInCssText(style.textContent, linkUrl, resolver);
6007 return style; 5808 return style;
6008 }, 5809 },
6009 resolveUrlsInCssText: function(cssText, linkUrl, urlObj) { 5810 resolveUrlsInCssText: function(cssText, linkUrl, urlObj) {
6010 var r = this.replaceUrls(cssText, urlObj, linkUrl, CSS_URL_REGEXP); 5811 var r = this.replaceUrls(cssText, urlObj, linkUrl, CSS_URL_REGEXP);
6011 r = this.replaceUrls(r, urlObj, linkUrl, CSS_IMPORT_REGEXP); 5812 r = this.replaceUrls(r, urlObj, linkUrl, CSS_IMPORT_REGEXP);
6012 return r; 5813 return r;
6013 }, 5814 },
6014 replaceUrls: function(text, urlObj, linkUrl, regexp) { 5815 replaceUrls: function(text, urlObj, linkUrl, regexp) {
6015 return text.replace(regexp, function(m, pre, url, post) { 5816 return text.replace(regexp, function(m, pre, url, post) {
6016 var urlPath = url.replace(/["']/g, ""); 5817 var urlPath = url.replace(/["']/g, "");
6017 if (linkUrl) { 5818 if (linkUrl) {
6018 urlPath = new URL(urlPath, linkUrl).href; 5819 urlPath = new URL(urlPath, linkUrl).href;
6019 } 5820 }
6020 urlObj.href = urlPath; 5821 urlObj.href = urlPath;
6021 urlPath = urlObj.href; 5822 urlPath = urlObj.href;
6022 return pre + "'" + urlPath + "'" + post; 5823 return pre + "'" + urlPath + "'" + post;
6023 }); 5824 });
6024 } 5825 }
6025 }; 5826 };
6026 scope.path = path; 5827 scope.path = path;
6027 }); 5828 });
6028 5829
6029 window.HTMLImports.addModule(function(scope) { 5830 HTMLImports.addModule(function(scope) {
6030 var xhr = { 5831 var xhr = {
6031 async: true, 5832 async: true,
6032 ok: function(request) { 5833 ok: function(request) {
6033 return request.status >= 200 && request.status < 300 || request.status === 304 || request.status === 0; 5834 return request.status >= 200 && request.status < 300 || request.status === 304 || request.status === 0;
6034 }, 5835 },
6035 load: function(url, next, nextContext) { 5836 load: function(url, next, nextContext) {
6036 var request = new XMLHttpRequest(); 5837 var request = new XMLHttpRequest();
6037 if (scope.flags.debug || scope.flags.bust) { 5838 if (scope.flags.debug || scope.flags.bust) {
6038 url += "?" + Math.random(); 5839 url += "?" + Math.random();
6039 } 5840 }
6040 request.open("GET", url, xhr.async); 5841 request.open("GET", url, xhr.async);
6041 request.addEventListener("readystatechange", function(e) { 5842 request.addEventListener("readystatechange", function(e) {
6042 if (request.readyState === 4) { 5843 if (request.readyState === 4) {
5844 var locationHeader = request.getResponseHeader("Location");
6043 var redirectedUrl = null; 5845 var redirectedUrl = null;
6044 try { 5846 if (locationHeader) {
6045 var locationHeader = request.getResponseHeader("Location"); 5847 var redirectedUrl = locationHeader.substr(0, 1) === "/" ? location.o rigin + locationHeader : locationHeader;
6046 if (locationHeader) {
6047 redirectedUrl = locationHeader.substr(0, 1) === "/" ? location.ori gin + locationHeader : locationHeader;
6048 }
6049 } catch (e) {
6050 console.error(e.message);
6051 } 5848 }
6052 next.call(nextContext, !xhr.ok(request) && request, request.response | | request.responseText, redirectedUrl); 5849 next.call(nextContext, !xhr.ok(request) && request, request.response | | request.responseText, redirectedUrl);
6053 } 5850 }
6054 }); 5851 });
6055 request.send(); 5852 request.send();
6056 return request; 5853 return request;
6057 }, 5854 },
6058 loadDocument: function(url, next, nextContext) { 5855 loadDocument: function(url, next, nextContext) {
6059 this.load(url, next, nextContext).responseType = "document"; 5856 this.load(url, next, nextContext).responseType = "document";
6060 } 5857 }
6061 }; 5858 };
6062 scope.xhr = xhr; 5859 scope.xhr = xhr;
6063 }); 5860 });
6064 5861
6065 window.HTMLImports.addModule(function(scope) { 5862 HTMLImports.addModule(function(scope) {
6066 var xhr = scope.xhr; 5863 var xhr = scope.xhr;
6067 var flags = scope.flags; 5864 var flags = scope.flags;
6068 var Loader = function(onLoad, onComplete) { 5865 var Loader = function(onLoad, onComplete) {
6069 this.cache = {}; 5866 this.cache = {};
6070 this.onload = onLoad; 5867 this.onload = onLoad;
6071 this.oncomplete = onComplete; 5868 this.oncomplete = onComplete;
6072 this.inflight = 0; 5869 this.inflight = 0;
6073 this.pending = {}; 5870 this.pending = {};
6074 }; 5871 };
6075 Loader.prototype = { 5872 Loader.prototype = {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
6148 }, 5945 },
6149 checkDone: function() { 5946 checkDone: function() {
6150 if (!this.inflight) { 5947 if (!this.inflight) {
6151 this.oncomplete(); 5948 this.oncomplete();
6152 } 5949 }
6153 } 5950 }
6154 }; 5951 };
6155 scope.Loader = Loader; 5952 scope.Loader = Loader;
6156 }); 5953 });
6157 5954
6158 window.HTMLImports.addModule(function(scope) { 5955 HTMLImports.addModule(function(scope) {
6159 var Observer = function(addCallback) { 5956 var Observer = function(addCallback) {
6160 this.addCallback = addCallback; 5957 this.addCallback = addCallback;
6161 this.mo = new MutationObserver(this.handler.bind(this)); 5958 this.mo = new MutationObserver(this.handler.bind(this));
6162 }; 5959 };
6163 Observer.prototype = { 5960 Observer.prototype = {
6164 handler: function(mutations) { 5961 handler: function(mutations) {
6165 for (var i = 0, l = mutations.length, m; i < l && (m = mutations[i]); i++) { 5962 for (var i = 0, l = mutations.length, m; i < l && (m = mutations[i]); i++) {
6166 if (m.type === "childList" && m.addedNodes.length) { 5963 if (m.type === "childList" && m.addedNodes.length) {
6167 this.addedNodes(m.addedNodes); 5964 this.addedNodes(m.addedNodes);
6168 } 5965 }
(...skipping 12 matching lines...) Expand all
6181 observe: function(root) { 5978 observe: function(root) {
6182 this.mo.observe(root, { 5979 this.mo.observe(root, {
6183 childList: true, 5980 childList: true,
6184 subtree: true 5981 subtree: true
6185 }); 5982 });
6186 } 5983 }
6187 }; 5984 };
6188 scope.Observer = Observer; 5985 scope.Observer = Observer;
6189 }); 5986 });
6190 5987
6191 window.HTMLImports.addModule(function(scope) { 5988 HTMLImports.addModule(function(scope) {
6192 var path = scope.path; 5989 var path = scope.path;
6193 var rootDocument = scope.rootDocument; 5990 var rootDocument = scope.rootDocument;
6194 var flags = scope.flags; 5991 var flags = scope.flags;
6195 var isIE = scope.isIE; 5992 var isIE = scope.isIE;
6196 var IMPORT_LINK_TYPE = scope.IMPORT_LINK_TYPE; 5993 var IMPORT_LINK_TYPE = scope.IMPORT_LINK_TYPE;
6197 var IMPORT_SELECTOR = "link[rel=" + IMPORT_LINK_TYPE + "]"; 5994 var IMPORT_SELECTOR = "link[rel=" + IMPORT_LINK_TYPE + "]";
6198 var importParser = { 5995 var importParser = {
6199 documentSelectors: IMPORT_SELECTOR, 5996 documentSelectors: IMPORT_SELECTOR,
6200 importsSelectors: [ IMPORT_SELECTOR, "link[rel=stylesheet]:not([type])", "st yle:not([type])", "script:not([type])", 'script[type="application/javascript"]', 'script[type="text/javascript"]' ].join(","), 5997 importsSelectors: [ IMPORT_SELECTOR, "link[rel=stylesheet]", "style", "scrip t:not([type])", 'script[type="text/javascript"]' ].join(","),
6201 map: { 5998 map: {
6202 link: "parseLink", 5999 link: "parseLink",
6203 script: "parseScript", 6000 script: "parseScript",
6204 style: "parseStyle" 6001 style: "parseStyle"
6205 }, 6002 },
6206 dynamicElements: [], 6003 dynamicElements: [],
6207 parseNext: function() { 6004 parseNext: function() {
6208 var next = this.nextToParse(); 6005 var next = this.nextToParse();
6209 if (next) { 6006 if (next) {
6210 this.parse(next); 6007 this.parse(next);
(...skipping 30 matching lines...) Expand all
6241 this.parsingElement = null; 6038 this.parsingElement = null;
6242 flags.parse && console.log("completed", elt); 6039 flags.parse && console.log("completed", elt);
6243 }, 6040 },
6244 markDynamicParsingComplete: function(elt) { 6041 markDynamicParsingComplete: function(elt) {
6245 var i = this.dynamicElements.indexOf(elt); 6042 var i = this.dynamicElements.indexOf(elt);
6246 if (i >= 0) { 6043 if (i >= 0) {
6247 this.dynamicElements.splice(i, 1); 6044 this.dynamicElements.splice(i, 1);
6248 } 6045 }
6249 }, 6046 },
6250 parseImport: function(elt) { 6047 parseImport: function(elt) {
6251 elt.import = elt.__doc; 6048 if (HTMLImports.__importsParsingHook) {
6252 if (window.HTMLImports.__importsParsingHook) { 6049 HTMLImports.__importsParsingHook(elt);
6253 window.HTMLImports.__importsParsingHook(elt);
6254 } 6050 }
6255 if (elt.import) { 6051 if (elt.import) {
6256 elt.import.__importParsed = true; 6052 elt.import.__importParsed = true;
6257 } 6053 }
6258 this.markParsingComplete(elt); 6054 this.markParsingComplete(elt);
6259 if (elt.__resource && !elt.__error) { 6055 if (elt.__resource && !elt.__error) {
6260 elt.dispatchEvent(new CustomEvent("load", { 6056 elt.dispatchEvent(new CustomEvent("load", {
6261 bubbles: false 6057 bubbles: false
6262 })); 6058 }));
6263 } else { 6059 } else {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
6304 } 6100 }
6305 return n; 6101 return n;
6306 }, 6102 },
6307 addElementToDocument: function(elt) { 6103 addElementToDocument: function(elt) {
6308 var port = this.rootImportForElement(elt.__importElement || elt); 6104 var port = this.rootImportForElement(elt.__importElement || elt);
6309 port.parentNode.insertBefore(elt, port); 6105 port.parentNode.insertBefore(elt, port);
6310 }, 6106 },
6311 trackElement: function(elt, callback) { 6107 trackElement: function(elt, callback) {
6312 var self = this; 6108 var self = this;
6313 var done = function(e) { 6109 var done = function(e) {
6314 elt.removeEventListener("load", done);
6315 elt.removeEventListener("error", done);
6316 if (callback) { 6110 if (callback) {
6317 callback(e); 6111 callback(e);
6318 } 6112 }
6319 self.markParsingComplete(elt); 6113 self.markParsingComplete(elt);
6320 self.parseNext(); 6114 self.parseNext();
6321 }; 6115 };
6322 elt.addEventListener("load", done); 6116 elt.addEventListener("load", done);
6323 elt.addEventListener("error", done); 6117 elt.addEventListener("error", done);
6324 if (isIE && elt.localName === "style") { 6118 if (isIE && elt.localName === "style") {
6325 var fakeLoad = false; 6119 var fakeLoad = false;
6326 if (elt.textContent.indexOf("@import") == -1) { 6120 if (elt.textContent.indexOf("@import") == -1) {
6327 fakeLoad = true; 6121 fakeLoad = true;
6328 } else if (elt.sheet) { 6122 } else if (elt.sheet) {
6329 fakeLoad = true; 6123 fakeLoad = true;
6330 var csr = elt.sheet.cssRules; 6124 var csr = elt.sheet.cssRules;
6331 var len = csr ? csr.length : 0; 6125 var len = csr ? csr.length : 0;
6332 for (var i = 0, r; i < len && (r = csr[i]); i++) { 6126 for (var i = 0, r; i < len && (r = csr[i]); i++) {
6333 if (r.type === CSSRule.IMPORT_RULE) { 6127 if (r.type === CSSRule.IMPORT_RULE) {
6334 fakeLoad = fakeLoad && Boolean(r.styleSheet); 6128 fakeLoad = fakeLoad && Boolean(r.styleSheet);
6335 } 6129 }
6336 } 6130 }
6337 } 6131 }
6338 if (fakeLoad) { 6132 if (fakeLoad) {
6339 setTimeout(function() { 6133 elt.dispatchEvent(new CustomEvent("load", {
6340 elt.dispatchEvent(new CustomEvent("load", { 6134 bubbles: false
6341 bubbles: false 6135 }));
6342 }));
6343 });
6344 } 6136 }
6345 } 6137 }
6346 }, 6138 },
6347 parseScript: function(scriptElt) { 6139 parseScript: function(scriptElt) {
6348 var script = document.createElement("script"); 6140 var script = document.createElement("script");
6349 script.__importElement = scriptElt; 6141 script.__importElement = scriptElt;
6350 script.src = scriptElt.src ? scriptElt.src : generateScriptDataUrl(scriptE lt); 6142 script.src = scriptElt.src ? scriptElt.src : generateScriptDataUrl(scriptE lt);
6351 scope.currentScript = scriptElt; 6143 scope.currentScript = scriptElt;
6352 this.trackElement(script, function(e) { 6144 this.trackElement(script, function(e) {
6353 if (script.parentNode) { 6145 script.parentNode.removeChild(script);
6354 script.parentNode.removeChild(script);
6355 }
6356 scope.currentScript = null; 6146 scope.currentScript = null;
6357 }); 6147 });
6358 this.addElementToDocument(script); 6148 this.addElementToDocument(script);
6359 }, 6149 },
6360 nextToParse: function() { 6150 nextToParse: function() {
6361 this._mayParse = []; 6151 this._mayParse = [];
6362 return !this.parsingElement && (this.nextToParseInDoc(rootDocument) || thi s.nextToParseDynamic()); 6152 return !this.parsingElement && (this.nextToParseInDoc(rootDocument) || thi s.nextToParseDynamic());
6363 }, 6153 },
6364 nextToParseInDoc: function(doc, link) { 6154 nextToParseInDoc: function(doc, link) {
6365 if (doc && this._mayParse.indexOf(doc) < 0) { 6155 if (doc && this._mayParse.indexOf(doc) < 0) {
6366 this._mayParse.push(doc); 6156 this._mayParse.push(doc);
6367 var nodes = doc.querySelectorAll(this.parseSelectorsForNode(doc)); 6157 var nodes = doc.querySelectorAll(this.parseSelectorsForNode(doc));
6368 for (var i = 0, l = nodes.length, n; i < l && (n = nodes[i]); i++) { 6158 for (var i = 0, l = nodes.length, p = 0, n; i < l && (n = nodes[i]); i++ ) {
6369 if (!this.isParsed(n)) { 6159 if (!this.isParsed(n)) {
6370 if (this.hasResource(n)) { 6160 if (this.hasResource(n)) {
6371 return nodeIsImport(n) ? this.nextToParseInDoc(n.__doc, n) : n; 6161 return nodeIsImport(n) ? this.nextToParseInDoc(n.import, n) : n;
6372 } else { 6162 } else {
6373 return; 6163 return;
6374 } 6164 }
6375 } 6165 }
6376 } 6166 }
6377 } 6167 }
6378 return link; 6168 return link;
6379 }, 6169 },
6380 nextToParseDynamic: function() { 6170 nextToParseDynamic: function() {
6381 return this.dynamicElements[0]; 6171 return this.dynamicElements[0];
6382 }, 6172 },
6383 parseSelectorsForNode: function(node) { 6173 parseSelectorsForNode: function(node) {
6384 var doc = node.ownerDocument || node; 6174 var doc = node.ownerDocument || node;
6385 return doc === rootDocument ? this.documentSelectors : this.importsSelecto rs; 6175 return doc === rootDocument ? this.documentSelectors : this.importsSelecto rs;
6386 }, 6176 },
6387 isParsed: function(node) { 6177 isParsed: function(node) {
6388 return node.__importParsed; 6178 return node.__importParsed;
6389 }, 6179 },
6390 needsDynamicParsing: function(elt) { 6180 needsDynamicParsing: function(elt) {
6391 return this.dynamicElements.indexOf(elt) >= 0; 6181 return this.dynamicElements.indexOf(elt) >= 0;
6392 }, 6182 },
6393 hasResource: function(node) { 6183 hasResource: function(node) {
6394 if (nodeIsImport(node) && node.__doc === undefined) { 6184 if (nodeIsImport(node) && node.import === undefined) {
6395 return false; 6185 return false;
6396 } 6186 }
6397 return true; 6187 return true;
6398 } 6188 }
6399 }; 6189 };
6400 function nodeIsImport(elt) { 6190 function nodeIsImport(elt) {
6401 return elt.localName === "link" && elt.rel === IMPORT_LINK_TYPE; 6191 return elt.localName === "link" && elt.rel === IMPORT_LINK_TYPE;
6402 } 6192 }
6403 function generateScriptDataUrl(script) { 6193 function generateScriptDataUrl(script) {
6404 var scriptContent = generateScriptContent(script); 6194 var scriptContent = generateScriptContent(script);
(...skipping 13 matching lines...) Expand all
6418 function cloneStyle(style) { 6208 function cloneStyle(style) {
6419 var clone = style.ownerDocument.createElement("style"); 6209 var clone = style.ownerDocument.createElement("style");
6420 clone.textContent = style.textContent; 6210 clone.textContent = style.textContent;
6421 path.resolveUrlsInStyle(clone); 6211 path.resolveUrlsInStyle(clone);
6422 return clone; 6212 return clone;
6423 } 6213 }
6424 scope.parser = importParser; 6214 scope.parser = importParser;
6425 scope.IMPORT_SELECTOR = IMPORT_SELECTOR; 6215 scope.IMPORT_SELECTOR = IMPORT_SELECTOR;
6426 }); 6216 });
6427 6217
6428 window.HTMLImports.addModule(function(scope) { 6218 HTMLImports.addModule(function(scope) {
6429 var flags = scope.flags; 6219 var flags = scope.flags;
6430 var IMPORT_LINK_TYPE = scope.IMPORT_LINK_TYPE; 6220 var IMPORT_LINK_TYPE = scope.IMPORT_LINK_TYPE;
6431 var IMPORT_SELECTOR = scope.IMPORT_SELECTOR; 6221 var IMPORT_SELECTOR = scope.IMPORT_SELECTOR;
6432 var rootDocument = scope.rootDocument; 6222 var rootDocument = scope.rootDocument;
6433 var Loader = scope.Loader; 6223 var Loader = scope.Loader;
6434 var Observer = scope.Observer; 6224 var Observer = scope.Observer;
6435 var parser = scope.parser; 6225 var parser = scope.parser;
6436 var importer = { 6226 var importer = {
6437 documents: {}, 6227 documents: {},
6438 documentPreloadSelectors: IMPORT_SELECTOR, 6228 documentPreloadSelectors: IMPORT_SELECTOR,
(...skipping 19 matching lines...) Expand all
6458 if (isImportLink(elt)) { 6248 if (isImportLink(elt)) {
6459 var doc = this.documents[url]; 6249 var doc = this.documents[url];
6460 if (doc === undefined) { 6250 if (doc === undefined) {
6461 doc = err ? null : makeDocument(resource, redirectedUrl || url); 6251 doc = err ? null : makeDocument(resource, redirectedUrl || url);
6462 if (doc) { 6252 if (doc) {
6463 doc.__importLink = elt; 6253 doc.__importLink = elt;
6464 this.bootDocument(doc); 6254 this.bootDocument(doc);
6465 } 6255 }
6466 this.documents[url] = doc; 6256 this.documents[url] = doc;
6467 } 6257 }
6468 elt.__doc = doc; 6258 elt.import = doc;
6469 } 6259 }
6470 parser.parseNext(); 6260 parser.parseNext();
6471 }, 6261 },
6472 bootDocument: function(doc) { 6262 bootDocument: function(doc) {
6473 this.loadSubtree(doc); 6263 this.loadSubtree(doc);
6474 this.observer.observe(doc); 6264 this.observer.observe(doc);
6475 parser.parseNext(); 6265 parser.parseNext();
6476 }, 6266 },
6477 loadedAll: function() { 6267 loadedAll: function() {
6478 parser.parseNext(); 6268 parser.parseNext();
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
6517 }, 6307 },
6518 configurable: true 6308 configurable: true
6519 }; 6309 };
6520 Object.defineProperty(document, "baseURI", baseURIDescriptor); 6310 Object.defineProperty(document, "baseURI", baseURIDescriptor);
6521 Object.defineProperty(rootDocument, "baseURI", baseURIDescriptor); 6311 Object.defineProperty(rootDocument, "baseURI", baseURIDescriptor);
6522 } 6312 }
6523 scope.importer = importer; 6313 scope.importer = importer;
6524 scope.importLoader = importLoader; 6314 scope.importLoader = importLoader;
6525 }); 6315 });
6526 6316
6527 window.HTMLImports.addModule(function(scope) { 6317 HTMLImports.addModule(function(scope) {
6528 var parser = scope.parser; 6318 var parser = scope.parser;
6529 var importer = scope.importer; 6319 var importer = scope.importer;
6530 var dynamic = { 6320 var dynamic = {
6531 added: function(nodes) { 6321 added: function(nodes) {
6532 var owner, parsed, loading; 6322 var owner, parsed, loading;
6533 for (var i = 0, l = nodes.length, n; i < l && (n = nodes[i]); i++) { 6323 for (var i = 0, l = nodes.length, n; i < l && (n = nodes[i]); i++) {
6534 if (!owner) { 6324 if (!owner) {
6535 owner = n.ownerDocument; 6325 owner = n.ownerDocument;
6536 parsed = parser.isParsed(owner); 6326 parsed = parser.isParsed(owner);
6537 } 6327 }
(...skipping 16 matching lines...) Expand all
6554 importer.observer.addCallback = dynamic.added.bind(dynamic); 6344 importer.observer.addCallback = dynamic.added.bind(dynamic);
6555 var matches = HTMLElement.prototype.matches || HTMLElement.prototype.matchesSe lector || HTMLElement.prototype.webkitMatchesSelector || HTMLElement.prototype.m ozMatchesSelector || HTMLElement.prototype.msMatchesSelector; 6345 var matches = HTMLElement.prototype.matches || HTMLElement.prototype.matchesSe lector || HTMLElement.prototype.webkitMatchesSelector || HTMLElement.prototype.m ozMatchesSelector || HTMLElement.prototype.msMatchesSelector;
6556 }); 6346 });
6557 6347
6558 (function(scope) { 6348 (function(scope) {
6559 var initializeModules = scope.initializeModules; 6349 var initializeModules = scope.initializeModules;
6560 var isIE = scope.isIE; 6350 var isIE = scope.isIE;
6561 if (scope.useNative) { 6351 if (scope.useNative) {
6562 return; 6352 return;
6563 } 6353 }
6354 if (isIE && typeof window.CustomEvent !== "function") {
6355 window.CustomEvent = function(inType, params) {
6356 params = params || {};
6357 var e = document.createEvent("CustomEvent");
6358 e.initCustomEvent(inType, Boolean(params.bubbles), Boolean(params.cancelab le), params.detail);
6359 return e;
6360 };
6361 window.CustomEvent.prototype = window.Event.prototype;
6362 }
6564 initializeModules(); 6363 initializeModules();
6565 var rootDocument = scope.rootDocument; 6364 var rootDocument = scope.rootDocument;
6566 function bootstrap() { 6365 function bootstrap() {
6567 window.HTMLImports.importer.bootDocument(rootDocument); 6366 HTMLImports.importer.bootDocument(rootDocument);
6568 } 6367 }
6569 if (document.readyState === "complete" || document.readyState === "interactive " && !window.attachEvent) { 6368 if (document.readyState === "complete" || document.readyState === "interactive " && !window.attachEvent) {
6570 bootstrap(); 6369 bootstrap();
6571 } else { 6370 } else {
6572 document.addEventListener("DOMContentLoaded", bootstrap); 6371 document.addEventListener("DOMContentLoaded", bootstrap);
6573 } 6372 }
6574 })(window.HTMLImports); 6373 })(HTMLImports);
6575 6374
6576 window.CustomElements = window.CustomElements || { 6375 window.CustomElements = window.CustomElements || {
6577 flags: {} 6376 flags: {}
6578 }; 6377 };
6579 6378
6580 (function(scope) { 6379 (function(scope) {
6581 var flags = scope.flags; 6380 var flags = scope.flags;
6582 var modules = []; 6381 var modules = [];
6583 var addModule = function(module) { 6382 var addModule = function(module) {
6584 modules.push(module); 6383 modules.push(module);
6585 }; 6384 };
6586 var initializeModules = function() { 6385 var initializeModules = function() {
6587 modules.forEach(function(module) { 6386 modules.forEach(function(module) {
6588 module(scope); 6387 module(scope);
6589 }); 6388 });
6590 }; 6389 };
6591 scope.addModule = addModule; 6390 scope.addModule = addModule;
6592 scope.initializeModules = initializeModules; 6391 scope.initializeModules = initializeModules;
6593 scope.hasNative = Boolean(document.registerElement); 6392 scope.hasNative = Boolean(document.registerElement);
6594 scope.isIE = /Trident/.test(navigator.userAgent); 6393 scope.useNative = !flags.register && scope.hasNative && !window.ShadowDOMPolyf ill && (!window.HTMLImports || HTMLImports.useNative);
6595 scope.useNative = !flags.register && scope.hasNative && !window.ShadowDOMPolyf ill && (!window.HTMLImports || window.HTMLImports.useNative); 6394 })(CustomElements);
6596 })(window.CustomElements);
6597 6395
6598 window.CustomElements.addModule(function(scope) { 6396 CustomElements.addModule(function(scope) {
6599 var IMPORT_LINK_TYPE = window.HTMLImports ? window.HTMLImports.IMPORT_LINK_TYP E : "none"; 6397 var IMPORT_LINK_TYPE = window.HTMLImports ? HTMLImports.IMPORT_LINK_TYPE : "no ne";
6600 function forSubtree(node, cb) { 6398 function forSubtree(node, cb) {
6601 findAllElements(node, function(e) { 6399 findAllElements(node, function(e) {
6602 if (cb(e)) { 6400 if (cb(e)) {
6603 return true; 6401 return true;
6604 } 6402 }
6605 forRoots(e, cb); 6403 forRoots(e, cb);
6606 }); 6404 });
6607 forRoots(node, cb); 6405 forRoots(node, cb);
6608 } 6406 }
6609 function findAllElements(node, find, data) { 6407 function findAllElements(node, find, data) {
(...skipping 16 matching lines...) Expand all
6626 var root = node.shadowRoot; 6424 var root = node.shadowRoot;
6627 while (root) { 6425 while (root) {
6628 forSubtree(root, cb); 6426 forSubtree(root, cb);
6629 root = root.olderShadowRoot; 6427 root = root.olderShadowRoot;
6630 } 6428 }
6631 } 6429 }
6632 function forDocumentTree(doc, cb) { 6430 function forDocumentTree(doc, cb) {
6633 _forDocumentTree(doc, cb, []); 6431 _forDocumentTree(doc, cb, []);
6634 } 6432 }
6635 function _forDocumentTree(doc, cb, processingDocuments) { 6433 function _forDocumentTree(doc, cb, processingDocuments) {
6636 doc = window.wrap(doc); 6434 doc = wrap(doc);
6637 if (processingDocuments.indexOf(doc) >= 0) { 6435 if (processingDocuments.indexOf(doc) >= 0) {
6638 return; 6436 return;
6639 } 6437 }
6640 processingDocuments.push(doc); 6438 processingDocuments.push(doc);
6641 var imports = doc.querySelectorAll("link[rel=" + IMPORT_LINK_TYPE + "]"); 6439 var imports = doc.querySelectorAll("link[rel=" + IMPORT_LINK_TYPE + "]");
6642 for (var i = 0, l = imports.length, n; i < l && (n = imports[i]); i++) { 6440 for (var i = 0, l = imports.length, n; i < l && (n = imports[i]); i++) {
6643 if (n.import) { 6441 if (n.import) {
6644 _forDocumentTree(n.import, cb, processingDocuments); 6442 _forDocumentTree(n.import, cb, processingDocuments);
6645 } 6443 }
6646 } 6444 }
6647 cb(doc); 6445 cb(doc);
6648 } 6446 }
6649 scope.forDocumentTree = forDocumentTree; 6447 scope.forDocumentTree = forDocumentTree;
6650 scope.forSubtree = forSubtree; 6448 scope.forSubtree = forSubtree;
6651 }); 6449 });
6652 6450
6653 window.CustomElements.addModule(function(scope) { 6451 CustomElements.addModule(function(scope) {
6654 var flags = scope.flags; 6452 var flags = scope.flags;
6655 var forSubtree = scope.forSubtree; 6453 var forSubtree = scope.forSubtree;
6656 var forDocumentTree = scope.forDocumentTree; 6454 var forDocumentTree = scope.forDocumentTree;
6657 function addedNode(node, isAttached) { 6455 function addedNode(node) {
6658 return added(node, isAttached) || addedSubtree(node, isAttached); 6456 return added(node) || addedSubtree(node);
6659 } 6457 }
6660 function added(node, isAttached) { 6458 function added(node) {
6661 if (scope.upgrade(node, isAttached)) { 6459 if (scope.upgrade(node)) {
6662 return true; 6460 return true;
6663 } 6461 }
6664 if (isAttached) { 6462 attached(node);
6665 attached(node);
6666 }
6667 } 6463 }
6668 function addedSubtree(node, isAttached) { 6464 function addedSubtree(node) {
6669 forSubtree(node, function(e) { 6465 forSubtree(node, function(e) {
6670 if (added(e, isAttached)) { 6466 if (added(e)) {
6671 return true; 6467 return true;
6672 } 6468 }
6673 }); 6469 });
6674 } 6470 }
6675 var hasThrottledAttached = window.MutationObserver._isPolyfilled && flags["thr ottle-attached"]; 6471 function attachedNode(node) {
6676 scope.hasPolyfillMutations = hasThrottledAttached; 6472 attached(node);
6677 scope.hasThrottledAttached = hasThrottledAttached; 6473 if (inDocument(node)) {
6474 forSubtree(node, function(e) {
6475 attached(e);
6476 });
6477 }
6478 }
6479 var hasPolyfillMutations = !window.MutationObserver || window.MutationObserver === window.JsMutationObserver;
6480 scope.hasPolyfillMutations = hasPolyfillMutations;
6678 var isPendingMutations = false; 6481 var isPendingMutations = false;
6679 var pendingMutations = []; 6482 var pendingMutations = [];
6680 function deferMutation(fn) { 6483 function deferMutation(fn) {
6681 pendingMutations.push(fn); 6484 pendingMutations.push(fn);
6682 if (!isPendingMutations) { 6485 if (!isPendingMutations) {
6683 isPendingMutations = true; 6486 isPendingMutations = true;
6684 setTimeout(takeMutations); 6487 setTimeout(takeMutations);
6685 } 6488 }
6686 } 6489 }
6687 function takeMutations() { 6490 function takeMutations() {
6688 isPendingMutations = false; 6491 isPendingMutations = false;
6689 var $p = pendingMutations; 6492 var $p = pendingMutations;
6690 for (var i = 0, l = $p.length, p; i < l && (p = $p[i]); i++) { 6493 for (var i = 0, l = $p.length, p; i < l && (p = $p[i]); i++) {
6691 p(); 6494 p();
6692 } 6495 }
6693 pendingMutations = []; 6496 pendingMutations = [];
6694 } 6497 }
6695 function attached(element) { 6498 function attached(element) {
6696 if (hasThrottledAttached) { 6499 if (hasPolyfillMutations) {
6697 deferMutation(function() { 6500 deferMutation(function() {
6698 _attached(element); 6501 _attached(element);
6699 }); 6502 });
6700 } else { 6503 } else {
6701 _attached(element); 6504 _attached(element);
6702 } 6505 }
6703 } 6506 }
6704 function _attached(element) { 6507 function _attached(element) {
6705 if (element.__upgraded__ && !element.__attached) { 6508 if (element.__upgraded__ && (element.attachedCallback || element.detachedCal lback)) {
6706 element.__attached = true; 6509 if (!element.__attached && inDocument(element)) {
6707 if (element.attachedCallback) { 6510 element.__attached = true;
6708 element.attachedCallback(); 6511 if (element.attachedCallback) {
6512 element.attachedCallback();
6513 }
6709 } 6514 }
6710 } 6515 }
6711 } 6516 }
6712 function detachedNode(node) { 6517 function detachedNode(node) {
6713 detached(node); 6518 detached(node);
6714 forSubtree(node, function(e) { 6519 forSubtree(node, function(e) {
6715 detached(e); 6520 detached(e);
6716 }); 6521 });
6717 } 6522 }
6718 function detached(element) { 6523 function detached(element) {
6719 if (hasThrottledAttached) { 6524 if (hasPolyfillMutations) {
6720 deferMutation(function() { 6525 deferMutation(function() {
6721 _detached(element); 6526 _detached(element);
6722 }); 6527 });
6723 } else { 6528 } else {
6724 _detached(element); 6529 _detached(element);
6725 } 6530 }
6726 } 6531 }
6727 function _detached(element) { 6532 function _detached(element) {
6728 if (element.__upgraded__ && element.__attached) { 6533 if (element.__upgraded__ && (element.attachedCallback || element.detachedCal lback)) {
6729 element.__attached = false; 6534 if (element.__attached && !inDocument(element)) {
6730 if (element.detachedCallback) { 6535 element.__attached = false;
6731 element.detachedCallback(); 6536 if (element.detachedCallback) {
6537 element.detachedCallback();
6538 }
6732 } 6539 }
6733 } 6540 }
6734 } 6541 }
6735 function inDocument(element) { 6542 function inDocument(element) {
6736 var p = element; 6543 var p = element;
6737 var doc = window.wrap(document); 6544 var doc = wrap(document);
6738 while (p) { 6545 while (p) {
6739 if (p == doc) { 6546 if (p == doc) {
6740 return true; 6547 return true;
6741 } 6548 }
6742 p = p.parentNode || p.nodeType === Node.DOCUMENT_FRAGMENT_NODE && p.host; 6549 p = p.parentNode || p.nodeType === Node.DOCUMENT_FRAGMENT_NODE && p.host;
6743 } 6550 }
6744 } 6551 }
6745 function watchShadow(node) { 6552 function watchShadow(node) {
6746 if (node.shadowRoot && !node.shadowRoot.__watched) { 6553 if (node.shadowRoot && !node.shadowRoot.__watched) {
6747 flags.dom && console.log("watching shadow-root for: ", node.localName); 6554 flags.dom && console.log("watching shadow-root for: ", node.localName);
6748 var root = node.shadowRoot; 6555 var root = node.shadowRoot;
6749 while (root) { 6556 while (root) {
6750 observe(root); 6557 observe(root);
6751 root = root.olderShadowRoot; 6558 root = root.olderShadowRoot;
6752 } 6559 }
6753 } 6560 }
6754 } 6561 }
6755 function handler(root, mutations) { 6562 function handler(mutations) {
6756 if (flags.dom) { 6563 if (flags.dom) {
6757 var mx = mutations[0]; 6564 var mx = mutations[0];
6758 if (mx && mx.type === "childList" && mx.addedNodes) { 6565 if (mx && mx.type === "childList" && mx.addedNodes) {
6759 if (mx.addedNodes) { 6566 if (mx.addedNodes) {
6760 var d = mx.addedNodes[0]; 6567 var d = mx.addedNodes[0];
6761 while (d && d !== document && !d.host) { 6568 while (d && d !== document && !d.host) {
6762 d = d.parentNode; 6569 d = d.parentNode;
6763 } 6570 }
6764 var u = d && (d.URL || d._URL || d.host && d.host.localName) || ""; 6571 var u = d && (d.URL || d._URL || d.host && d.host.localName) || "";
6765 u = u.split("/?").shift().split("/").pop(); 6572 u = u.split("/?").shift().split("/").pop();
6766 } 6573 }
6767 } 6574 }
6768 console.group("mutations (%d) [%s]", mutations.length, u || ""); 6575 console.group("mutations (%d) [%s]", mutations.length, u || "");
6769 } 6576 }
6770 var isAttached = inDocument(root);
6771 mutations.forEach(function(mx) { 6577 mutations.forEach(function(mx) {
6772 if (mx.type === "childList") { 6578 if (mx.type === "childList") {
6773 forEach(mx.addedNodes, function(n) { 6579 forEach(mx.addedNodes, function(n) {
6774 if (!n.localName) { 6580 if (!n.localName) {
6775 return; 6581 return;
6776 } 6582 }
6777 addedNode(n, isAttached); 6583 addedNode(n);
6778 }); 6584 });
6779 forEach(mx.removedNodes, function(n) { 6585 forEach(mx.removedNodes, function(n) {
6780 if (!n.localName) { 6586 if (!n.localName) {
6781 return; 6587 return;
6782 } 6588 }
6783 detachedNode(n); 6589 detachedNode(n);
6784 }); 6590 });
6785 } 6591 }
6786 }); 6592 });
6787 flags.dom && console.groupEnd(); 6593 flags.dom && console.groupEnd();
6788 } 6594 }
6789 function takeRecords(node) { 6595 function takeRecords(node) {
6790 node = window.wrap(node); 6596 node = wrap(node);
6791 if (!node) { 6597 if (!node) {
6792 node = window.wrap(document); 6598 node = wrap(document);
6793 } 6599 }
6794 while (node.parentNode) { 6600 while (node.parentNode) {
6795 node = node.parentNode; 6601 node = node.parentNode;
6796 } 6602 }
6797 var observer = node.__observer; 6603 var observer = node.__observer;
6798 if (observer) { 6604 if (observer) {
6799 handler(node, observer.takeRecords()); 6605 handler(observer.takeRecords());
6800 takeMutations(); 6606 takeMutations();
6801 } 6607 }
6802 } 6608 }
6803 var forEach = Array.prototype.forEach.call.bind(Array.prototype.forEach); 6609 var forEach = Array.prototype.forEach.call.bind(Array.prototype.forEach);
6804 function observe(inRoot) { 6610 function observe(inRoot) {
6805 if (inRoot.__observer) { 6611 if (inRoot.__observer) {
6806 return; 6612 return;
6807 } 6613 }
6808 var observer = new MutationObserver(handler.bind(this, inRoot)); 6614 var observer = new MutationObserver(handler);
6809 observer.observe(inRoot, { 6615 observer.observe(inRoot, {
6810 childList: true, 6616 childList: true,
6811 subtree: true 6617 subtree: true
6812 }); 6618 });
6813 inRoot.__observer = observer; 6619 inRoot.__observer = observer;
6814 } 6620 }
6815 function upgradeDocument(doc) { 6621 function upgradeDocument(doc) {
6816 doc = window.wrap(doc); 6622 doc = wrap(doc);
6817 flags.dom && console.group("upgradeDocument: ", doc.baseURI.split("/").pop() ); 6623 flags.dom && console.group("upgradeDocument: ", doc.baseURI.split("/").pop() );
6818 var isMainDocument = doc === window.wrap(document); 6624 addedNode(doc);
6819 addedNode(doc, isMainDocument);
6820 observe(doc); 6625 observe(doc);
6821 flags.dom && console.groupEnd(); 6626 flags.dom && console.groupEnd();
6822 } 6627 }
6823 function upgradeDocumentTree(doc) { 6628 function upgradeDocumentTree(doc) {
6824 forDocumentTree(doc, upgradeDocument); 6629 forDocumentTree(doc, upgradeDocument);
6825 } 6630 }
6826 var originalCreateShadowRoot = Element.prototype.createShadowRoot; 6631 var originalCreateShadowRoot = Element.prototype.createShadowRoot;
6827 if (originalCreateShadowRoot) { 6632 if (originalCreateShadowRoot) {
6828 Element.prototype.createShadowRoot = function() { 6633 Element.prototype.createShadowRoot = function() {
6829 var root = originalCreateShadowRoot.call(this); 6634 var root = originalCreateShadowRoot.call(this);
6830 window.CustomElements.watchShadow(this); 6635 CustomElements.watchShadow(this);
6831 return root; 6636 return root;
6832 }; 6637 };
6833 } 6638 }
6834 scope.watchShadow = watchShadow; 6639 scope.watchShadow = watchShadow;
6835 scope.upgradeDocumentTree = upgradeDocumentTree; 6640 scope.upgradeDocumentTree = upgradeDocumentTree;
6836 scope.upgradeDocument = upgradeDocument;
6837 scope.upgradeSubtree = addedSubtree; 6641 scope.upgradeSubtree = addedSubtree;
6838 scope.upgradeAll = addedNode; 6642 scope.upgradeAll = addedNode;
6839 scope.attached = attached; 6643 scope.attachedNode = attachedNode;
6840 scope.takeRecords = takeRecords; 6644 scope.takeRecords = takeRecords;
6841 }); 6645 });
6842 6646
6843 window.CustomElements.addModule(function(scope) { 6647 CustomElements.addModule(function(scope) {
6844 var flags = scope.flags; 6648 var flags = scope.flags;
6845 function upgrade(node, isAttached) { 6649 function upgrade(node) {
6846 if (node.localName === "template") {
6847 if (window.HTMLTemplateElement && HTMLTemplateElement.decorate) {
6848 HTMLTemplateElement.decorate(node);
6849 }
6850 }
6851 if (!node.__upgraded__ && node.nodeType === Node.ELEMENT_NODE) { 6650 if (!node.__upgraded__ && node.nodeType === Node.ELEMENT_NODE) {
6852 var is = node.getAttribute("is"); 6651 var is = node.getAttribute("is");
6853 var definition = scope.getRegisteredDefinition(node.localName) || scope.ge tRegisteredDefinition(is); 6652 var definition = scope.getRegisteredDefinition(is || node.localName);
6854 if (definition) { 6653 if (definition) {
6855 if (is && definition.tag == node.localName || !is && !definition.extends ) { 6654 if (is && definition.tag == node.localName) {
6856 return upgradeWithDefinition(node, definition, isAttached); 6655 return upgradeWithDefinition(node, definition);
6656 } else if (!is && !definition.extends) {
6657 return upgradeWithDefinition(node, definition);
6857 } 6658 }
6858 } 6659 }
6859 } 6660 }
6860 } 6661 }
6861 function upgradeWithDefinition(element, definition, isAttached) { 6662 function upgradeWithDefinition(element, definition) {
6862 flags.upgrade && console.group("upgrade:", element.localName); 6663 flags.upgrade && console.group("upgrade:", element.localName);
6863 if (definition.is) { 6664 if (definition.is) {
6864 element.setAttribute("is", definition.is); 6665 element.setAttribute("is", definition.is);
6865 } 6666 }
6866 implementPrototype(element, definition); 6667 implementPrototype(element, definition);
6867 element.__upgraded__ = true; 6668 element.__upgraded__ = true;
6868 created(element); 6669 created(element);
6869 if (isAttached) { 6670 scope.attachedNode(element);
6870 scope.attached(element); 6671 scope.upgradeSubtree(element);
6871 }
6872 scope.upgradeSubtree(element, isAttached);
6873 flags.upgrade && console.groupEnd(); 6672 flags.upgrade && console.groupEnd();
6874 return element; 6673 return element;
6875 } 6674 }
6876 function implementPrototype(element, definition) { 6675 function implementPrototype(element, definition) {
6877 if (Object.__proto__) { 6676 if (Object.__proto__) {
6878 element.__proto__ = definition.prototype; 6677 element.__proto__ = definition.prototype;
6879 } else { 6678 } else {
6880 customMixin(element, definition.prototype, definition.native); 6679 customMixin(element, definition.prototype, definition.native);
6881 element.__proto__ = definition.prototype; 6680 element.__proto__ = definition.prototype;
6882 } 6681 }
(...skipping 15 matching lines...) Expand all
6898 function created(element) { 6697 function created(element) {
6899 if (element.createdCallback) { 6698 if (element.createdCallback) {
6900 element.createdCallback(); 6699 element.createdCallback();
6901 } 6700 }
6902 } 6701 }
6903 scope.upgrade = upgrade; 6702 scope.upgrade = upgrade;
6904 scope.upgradeWithDefinition = upgradeWithDefinition; 6703 scope.upgradeWithDefinition = upgradeWithDefinition;
6905 scope.implementPrototype = implementPrototype; 6704 scope.implementPrototype = implementPrototype;
6906 }); 6705 });
6907 6706
6908 window.CustomElements.addModule(function(scope) { 6707 CustomElements.addModule(function(scope) {
6909 var isIE = scope.isIE; 6708 var isIE11OrOlder = scope.isIE11OrOlder;
6910 var upgradeDocumentTree = scope.upgradeDocumentTree; 6709 var upgradeDocumentTree = scope.upgradeDocumentTree;
6911 var upgradeAll = scope.upgradeAll; 6710 var upgradeAll = scope.upgradeAll;
6912 var upgradeWithDefinition = scope.upgradeWithDefinition; 6711 var upgradeWithDefinition = scope.upgradeWithDefinition;
6913 var implementPrototype = scope.implementPrototype; 6712 var implementPrototype = scope.implementPrototype;
6914 var useNative = scope.useNative; 6713 var useNative = scope.useNative;
6915 function register(name, options) { 6714 function register(name, options) {
6916 var definition = options || {}; 6715 var definition = options || {};
6917 if (!name) { 6716 if (!name) {
6918 throw new Error("document.registerElement: first argument `name` must not be empty"); 6717 throw new Error("document.registerElement: first argument `name` must not be empty");
6919 } 6718 }
6920 if (name.indexOf("-") < 0) { 6719 if (name.indexOf("-") < 0) {
6921 throw new Error("document.registerElement: first argument ('name') must co ntain a dash ('-'). Argument provided was '" + String(name) + "'."); 6720 throw new Error("document.registerElement: first argument ('name') must co ntain a dash ('-'). Argument provided was '" + String(name) + "'.");
6922 } 6721 }
6923 if (isReservedTag(name)) { 6722 if (isReservedTag(name)) {
6924 throw new Error("Failed to execute 'registerElement' on 'Document': Regist ration failed for type '" + String(name) + "'. The type name is invalid."); 6723 throw new Error("Failed to execute 'registerElement' on 'Document': Regist ration failed for type '" + String(name) + "'. The type name is invalid.");
6925 } 6724 }
6926 if (getRegisteredDefinition(name)) { 6725 if (getRegisteredDefinition(name)) {
6927 throw new Error("DuplicateDefinitionError: a type with name '" + String(na me) + "' is already registered"); 6726 throw new Error("DuplicateDefinitionError: a type with name '" + String(na me) + "' is already registered");
6928 } 6727 }
6929 if (!definition.prototype) { 6728 if (!definition.prototype) {
6930 definition.prototype = Object.create(HTMLElement.prototype); 6729 definition.prototype = Object.create(HTMLElement.prototype);
6931 } 6730 }
6932 definition.__name = name.toLowerCase(); 6731 definition.__name = name.toLowerCase();
6933 if (definition.extends) {
6934 definition.extends = definition.extends.toLowerCase();
6935 }
6936 definition.lifecycle = definition.lifecycle || {}; 6732 definition.lifecycle = definition.lifecycle || {};
6937 definition.ancestry = ancestry(definition.extends); 6733 definition.ancestry = ancestry(definition.extends);
6938 resolveTagName(definition); 6734 resolveTagName(definition);
6939 resolvePrototypeChain(definition); 6735 resolvePrototypeChain(definition);
6940 overrideAttributeApi(definition.prototype); 6736 overrideAttributeApi(definition.prototype);
6941 registerDefinition(definition.__name, definition); 6737 registerDefinition(definition.__name, definition);
6942 definition.ctor = generateConstructor(definition); 6738 definition.ctor = generateConstructor(definition);
6943 definition.ctor.prototype = definition.prototype; 6739 definition.ctor.prototype = definition.prototype;
6944 definition.prototype.constructor = definition.ctor; 6740 definition.prototype.constructor = definition.ctor;
6945 if (scope.ready) { 6741 if (scope.ready) {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
6993 definition.tag = baseTag || definition.__name; 6789 definition.tag = baseTag || definition.__name;
6994 if (baseTag) { 6790 if (baseTag) {
6995 definition.is = definition.__name; 6791 definition.is = definition.__name;
6996 } 6792 }
6997 } 6793 }
6998 function resolvePrototypeChain(definition) { 6794 function resolvePrototypeChain(definition) {
6999 if (!Object.__proto__) { 6795 if (!Object.__proto__) {
7000 var nativePrototype = HTMLElement.prototype; 6796 var nativePrototype = HTMLElement.prototype;
7001 if (definition.is) { 6797 if (definition.is) {
7002 var inst = document.createElement(definition.tag); 6798 var inst = document.createElement(definition.tag);
7003 nativePrototype = Object.getPrototypeOf(inst); 6799 var expectedPrototype = Object.getPrototypeOf(inst);
6800 if (expectedPrototype === definition.prototype) {
6801 nativePrototype = expectedPrototype;
6802 }
7004 } 6803 }
7005 var proto = definition.prototype, ancestor; 6804 var proto = definition.prototype, ancestor;
7006 var foundPrototype = false; 6805 while (proto && proto !== nativePrototype) {
7007 while (proto) {
7008 if (proto == nativePrototype) {
7009 foundPrototype = true;
7010 }
7011 ancestor = Object.getPrototypeOf(proto); 6806 ancestor = Object.getPrototypeOf(proto);
7012 if (ancestor) { 6807 proto.__proto__ = ancestor;
7013 proto.__proto__ = ancestor;
7014 }
7015 proto = ancestor; 6808 proto = ancestor;
7016 } 6809 }
7017 if (!foundPrototype) {
7018 console.warn(definition.tag + " prototype not found in prototype chain f or " + definition.is);
7019 }
7020 definition.native = nativePrototype; 6810 definition.native = nativePrototype;
7021 } 6811 }
7022 } 6812 }
7023 function instantiate(definition) { 6813 function instantiate(definition) {
7024 return upgradeWithDefinition(domCreateElement(definition.tag), definition); 6814 return upgradeWithDefinition(domCreateElement(definition.tag), definition);
7025 } 6815 }
7026 var registry = {}; 6816 var registry = {};
7027 function getRegisteredDefinition(name) { 6817 function getRegisteredDefinition(name) {
7028 if (name) { 6818 if (name) {
7029 return registry[name.toLowerCase()]; 6819 return registry[name.toLowerCase()];
7030 } 6820 }
7031 } 6821 }
7032 function registerDefinition(name, definition) { 6822 function registerDefinition(name, definition) {
7033 registry[name] = definition; 6823 registry[name] = definition;
7034 } 6824 }
7035 function generateConstructor(definition) { 6825 function generateConstructor(definition) {
7036 return function() { 6826 return function() {
7037 return instantiate(definition); 6827 return instantiate(definition);
7038 }; 6828 };
7039 } 6829 }
7040 var HTML_NAMESPACE = "http://www.w3.org/1999/xhtml"; 6830 var HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
7041 function createElementNS(namespace, tag, typeExtension) { 6831 function createElementNS(namespace, tag, typeExtension) {
7042 if (namespace === HTML_NAMESPACE) { 6832 if (namespace === HTML_NAMESPACE) {
7043 return createElement(tag, typeExtension); 6833 return createElement(tag, typeExtension);
7044 } else { 6834 } else {
7045 return domCreateElementNS(namespace, tag); 6835 return domCreateElementNS(namespace, tag);
7046 } 6836 }
7047 } 6837 }
7048 function createElement(tag, typeExtension) { 6838 function createElement(tag, typeExtension) {
7049 if (tag) {
7050 tag = tag.toLowerCase();
7051 }
7052 if (typeExtension) {
7053 typeExtension = typeExtension.toLowerCase();
7054 }
7055 var definition = getRegisteredDefinition(typeExtension || tag); 6839 var definition = getRegisteredDefinition(typeExtension || tag);
7056 if (definition) { 6840 if (definition) {
7057 if (tag == definition.tag && typeExtension == definition.is) { 6841 if (tag == definition.tag && typeExtension == definition.is) {
7058 return new definition.ctor(); 6842 return new definition.ctor();
7059 } 6843 }
7060 if (!typeExtension && !definition.is) { 6844 if (!typeExtension && !definition.is) {
7061 return new definition.ctor(); 6845 return new definition.ctor();
7062 } 6846 }
7063 } 6847 }
7064 var element; 6848 var element;
7065 if (typeExtension) { 6849 if (typeExtension) {
7066 element = createElement(tag); 6850 element = createElement(tag);
7067 element.setAttribute("is", typeExtension); 6851 element.setAttribute("is", typeExtension);
7068 return element; 6852 return element;
7069 } 6853 }
7070 element = domCreateElement(tag); 6854 element = domCreateElement(tag);
7071 if (tag.indexOf("-") >= 0) { 6855 if (tag.indexOf("-") >= 0) {
7072 implementPrototype(element, HTMLElement); 6856 implementPrototype(element, HTMLElement);
7073 } 6857 }
7074 return element; 6858 return element;
7075 } 6859 }
7076 var domCreateElement = document.createElement.bind(document); 6860 var domCreateElement = document.createElement.bind(document);
7077 var domCreateElementNS = document.createElementNS.bind(document); 6861 var domCreateElementNS = document.createElementNS.bind(document);
7078 var isInstance; 6862 var isInstance;
7079 if (!Object.__proto__ && !useNative) { 6863 if (!Object.__proto__ && !useNative) {
7080 isInstance = function(obj, ctor) { 6864 isInstance = function(obj, ctor) {
7081 if (obj instanceof ctor) {
7082 return true;
7083 }
7084 var p = obj; 6865 var p = obj;
7085 while (p) { 6866 while (p) {
7086 if (p === ctor.prototype) { 6867 if (p === ctor.prototype) {
7087 return true; 6868 return true;
7088 } 6869 }
7089 p = p.__proto__; 6870 p = p.__proto__;
7090 } 6871 }
7091 return false; 6872 return false;
7092 }; 6873 };
7093 } else { 6874 } else {
7094 isInstance = function(obj, base) { 6875 isInstance = function(obj, base) {
7095 return obj instanceof base; 6876 return obj instanceof base;
7096 }; 6877 };
7097 } 6878 }
7098 function wrapDomMethodToForceUpgrade(obj, methodName) { 6879 function wrapDomMethodToForceUpgrade(obj, methodName) {
7099 var orig = obj[methodName]; 6880 var orig = obj[methodName];
7100 obj[methodName] = function() { 6881 obj[methodName] = function() {
7101 var n = orig.apply(this, arguments); 6882 var n = orig.apply(this, arguments);
7102 upgradeAll(n); 6883 upgradeAll(n);
7103 return n; 6884 return n;
7104 }; 6885 };
7105 } 6886 }
7106 wrapDomMethodToForceUpgrade(Node.prototype, "cloneNode"); 6887 wrapDomMethodToForceUpgrade(Node.prototype, "cloneNode");
7107 wrapDomMethodToForceUpgrade(document, "importNode"); 6888 wrapDomMethodToForceUpgrade(document, "importNode");
6889 if (isIE11OrOlder) {
6890 (function() {
6891 var importNode = document.importNode;
6892 document.importNode = function() {
6893 var n = importNode.apply(document, arguments);
6894 if (n.nodeType == n.DOCUMENT_FRAGMENT_NODE) {
6895 var f = document.createDocumentFragment();
6896 f.appendChild(n);
6897 return f;
6898 } else {
6899 return n;
6900 }
6901 };
6902 })();
6903 }
7108 document.registerElement = register; 6904 document.registerElement = register;
7109 document.createElement = createElement; 6905 document.createElement = createElement;
7110 document.createElementNS = createElementNS; 6906 document.createElementNS = createElementNS;
7111 scope.registry = registry; 6907 scope.registry = registry;
7112 scope.instanceof = isInstance; 6908 scope.instanceof = isInstance;
7113 scope.reservedTagList = reservedTagList; 6909 scope.reservedTagList = reservedTagList;
7114 scope.getRegisteredDefinition = getRegisteredDefinition; 6910 scope.getRegisteredDefinition = getRegisteredDefinition;
7115 document.register = document.registerElement; 6911 document.register = document.registerElement;
7116 }); 6912 });
7117 6913
7118 (function(scope) { 6914 (function(scope) {
7119 var useNative = scope.useNative; 6915 var useNative = scope.useNative;
7120 var initializeModules = scope.initializeModules; 6916 var initializeModules = scope.initializeModules;
7121 var isIE = scope.isIE; 6917 var isIE11OrOlder = /Trident/.test(navigator.userAgent);
7122 if (useNative) { 6918 if (useNative) {
7123 var nop = function() {}; 6919 var nop = function() {};
7124 scope.watchShadow = nop; 6920 scope.watchShadow = nop;
7125 scope.upgrade = nop; 6921 scope.upgrade = nop;
7126 scope.upgradeAll = nop; 6922 scope.upgradeAll = nop;
7127 scope.upgradeDocumentTree = nop; 6923 scope.upgradeDocumentTree = nop;
7128 scope.upgradeSubtree = nop; 6924 scope.upgradeSubtree = nop;
7129 scope.takeRecords = nop; 6925 scope.takeRecords = nop;
7130 scope.instanceof = function(obj, base) { 6926 scope.instanceof = function(obj, base) {
7131 return obj instanceof base; 6927 return obj instanceof base;
7132 }; 6928 };
7133 } else { 6929 } else {
7134 initializeModules(); 6930 initializeModules();
7135 } 6931 }
7136 var upgradeDocumentTree = scope.upgradeDocumentTree; 6932 var upgradeDocumentTree = scope.upgradeDocumentTree;
7137 var upgradeDocument = scope.upgradeDocument;
7138 if (!window.wrap) { 6933 if (!window.wrap) {
7139 if (window.ShadowDOMPolyfill) { 6934 if (window.ShadowDOMPolyfill) {
7140 window.wrap = window.ShadowDOMPolyfill.wrapIfNeeded; 6935 window.wrap = ShadowDOMPolyfill.wrapIfNeeded;
7141 window.unwrap = window.ShadowDOMPolyfill.unwrapIfNeeded; 6936 window.unwrap = ShadowDOMPolyfill.unwrapIfNeeded;
7142 } else { 6937 } else {
7143 window.wrap = window.unwrap = function(node) { 6938 window.wrap = window.unwrap = function(node) {
7144 return node; 6939 return node;
7145 }; 6940 };
7146 } 6941 }
7147 } 6942 }
7148 if (window.HTMLImports) { 6943 function bootstrap() {
7149 window.HTMLImports.__importsParsingHook = function(elt) { 6944 upgradeDocumentTree(wrap(document));
7150 if (elt.import) { 6945 if (window.HTMLImports) {
7151 upgradeDocument(wrap(elt.import)); 6946 HTMLImports.__importsParsingHook = function(elt) {
6947 upgradeDocumentTree(wrap(elt.import));
6948 };
6949 }
6950 CustomElements.ready = true;
6951 setTimeout(function() {
6952 CustomElements.readyTime = Date.now();
6953 if (window.HTMLImports) {
6954 CustomElements.elapsed = CustomElements.readyTime - HTMLImports.readyTim e;
7152 } 6955 }
6956 document.dispatchEvent(new CustomEvent("WebComponentsReady", {
6957 bubbles: true
6958 }));
6959 });
6960 }
6961 if (isIE11OrOlder && typeof window.CustomEvent !== "function") {
6962 window.CustomEvent = function(inType, params) {
6963 params = params || {};
6964 var e = document.createEvent("CustomEvent");
6965 e.initCustomEvent(inType, Boolean(params.bubbles), Boolean(params.cancelab le), params.detail);
6966 return e;
7153 }; 6967 };
7154 } 6968 window.CustomEvent.prototype = window.Event.prototype;
7155 function bootstrap() {
7156 upgradeDocumentTree(window.wrap(document));
7157 window.CustomElements.ready = true;
7158 var requestAnimationFrame = window.requestAnimationFrame || function(f) {
7159 setTimeout(f, 16);
7160 };
7161 requestAnimationFrame(function() {
7162 setTimeout(function() {
7163 window.CustomElements.readyTime = Date.now();
7164 if (window.HTMLImports) {
7165 window.CustomElements.elapsed = window.CustomElements.readyTime - wind ow.HTMLImports.readyTime;
7166 }
7167 document.dispatchEvent(new CustomEvent("WebComponentsReady", {
7168 bubbles: true
7169 }));
7170 });
7171 });
7172 } 6969 }
7173 if (document.readyState === "complete" || scope.flags.eager) { 6970 if (document.readyState === "complete" || scope.flags.eager) {
7174 bootstrap(); 6971 bootstrap();
7175 } else if (document.readyState === "interactive" && !window.attachEvent && (!w indow.HTMLImports || window.HTMLImports.ready)) { 6972 } else if (document.readyState === "interactive" && !window.attachEvent && (!w indow.HTMLImports || window.HTMLImports.ready)) {
7176 bootstrap(); 6973 bootstrap();
7177 } else { 6974 } else {
7178 var loadEvent = window.HTMLImports && !window.HTMLImports.ready ? "HTMLImpor tsLoaded" : "DOMContentLoaded"; 6975 var loadEvent = window.HTMLImports && !HTMLImports.ready ? "HTMLImportsLoade d" : "DOMContentLoaded";
7179 window.addEventListener(loadEvent, bootstrap); 6976 window.addEventListener(loadEvent, bootstrap);
7180 } 6977 }
6978 scope.isIE11OrOlder = isIE11OrOlder;
7181 })(window.CustomElements); 6979 })(window.CustomElements);
7182 6980
7183 (function(scope) { 6981 (function(scope) {
7184 if (!Function.prototype.bind) { 6982 if (!Function.prototype.bind) {
7185 Function.prototype.bind = function(scope) { 6983 Function.prototype.bind = function(scope) {
7186 var self = this; 6984 var self = this;
7187 var args = Array.prototype.slice.call(arguments, 1); 6985 var args = Array.prototype.slice.call(arguments, 1);
7188 return function() { 6986 return function() {
7189 var args2 = args.slice(); 6987 var args2 = args.slice();
7190 args2.push.apply(args2, arguments); 6988 args2.push.apply(args2, arguments);
7191 return self.apply(scope, args2); 6989 return self.apply(scope, args2);
7192 }; 6990 };
7193 }; 6991 };
7194 } 6992 }
7195 })(window.WebComponents); 6993 })(window.WebComponents);
7196 6994
7197 (function(scope) { 6995 (function(scope) {
6996 "use strict";
6997 if (!window.performance) {
6998 var start = Date.now();
6999 window.performance = {
7000 now: function() {
7001 return Date.now() - start;
7002 }
7003 };
7004 }
7005 if (!window.requestAnimationFrame) {
7006 window.requestAnimationFrame = function() {
7007 var nativeRaf = window.webkitRequestAnimationFrame || window.mozRequestAni mationFrame;
7008 return nativeRaf ? function(callback) {
7009 return nativeRaf(function() {
7010 callback(performance.now());
7011 });
7012 } : function(callback) {
7013 return window.setTimeout(callback, 1e3 / 60);
7014 };
7015 }();
7016 }
7017 if (!window.cancelAnimationFrame) {
7018 window.cancelAnimationFrame = function() {
7019 return window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame || function(id) {
7020 clearTimeout(id);
7021 };
7022 }();
7023 }
7024 var elementDeclarations = [];
7025 var polymerStub = function(name, dictionary) {
7026 if (typeof name !== "string" && arguments.length === 1) {
7027 Array.prototype.push.call(arguments, document._currentScript);
7028 }
7029 elementDeclarations.push(arguments);
7030 };
7031 window.Polymer = polymerStub;
7032 scope.consumeDeclarations = function(callback) {
7033 scope.consumeDeclarations = function() {
7034 throw "Possible attempt to load Polymer twice";
7035 };
7036 if (callback) {
7037 callback(elementDeclarations);
7038 }
7039 elementDeclarations = null;
7040 };
7041 function installPolymerWarning() {
7042 if (window.Polymer === polymerStub) {
7043 window.Polymer = function() {
7044 throw new Error("You tried to use polymer without loading it first. To " + 'load polymer, <link rel="import" href="' + 'components/polymer/polymer.html" >');
7045 };
7046 }
7047 }
7048 if (HTMLImports.useNative) {
7049 installPolymerWarning();
7050 } else {
7051 addEventListener("DOMContentLoaded", installPolymerWarning);
7052 }
7053 })(window.WebComponents);
7054
7055 (function(scope) {
7198 var style = document.createElement("style"); 7056 var style = document.createElement("style");
7199 style.textContent = "" + "body {" + "transition: opacity ease-in 0.2s;" + " } \n" + "body[unresolved] {" + "opacity: 0; display: block; overflow: hidden; posi tion: relative;" + " } \n"; 7057 style.textContent = "" + "body {" + "transition: opacity ease-in 0.2s;" + " } \n" + "body[unresolved] {" + "opacity: 0; display: block; overflow: hidden; posi tion: relative;" + " } \n";
7200 var head = document.querySelector("head"); 7058 var head = document.querySelector("head");
7201 head.insertBefore(style, head.firstChild); 7059 head.insertBefore(style, head.firstChild);
7202 })(window.WebComponents); 7060 })(window.WebComponents);
7203 7061
7204 (function(scope) { 7062 (function(scope) {
7205 window.Platform = scope; 7063 window.Platform = scope;
7206 })(window.WebComponents); 7064 })(window.WebComponents);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698