| OLD | NEW |
| 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.21 | 10 // @version 0.7.23 |
| 11 (function() { | 11 (function() { |
| 12 window.WebComponents = window.WebComponents || { | 12 window.WebComponents = window.WebComponents || { |
| 13 flags: {} | 13 flags: {} |
| 14 }; | 14 }; |
| 15 var file = "webcomponents-lite.js"; | 15 var file = "webcomponents-lite.js"; |
| 16 var script = document.querySelector('script[src*="' + file + '"]'); | 16 var script = document.querySelector('script[src*="' + file + '"]'); |
| 17 var flags = {}; | 17 var flags = {}; |
| 18 if (!flags.noOpts) { | 18 if (!flags.noOpts) { |
| 19 location.search.slice(1).split("&").forEach(function(option) { | 19 location.search.slice(1).split("&").forEach(function(option) { |
| 20 var parts = option.split("="); | 20 var parts = option.split("="); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 break; | 158 break; |
| 159 | 159 |
| 160 case "scheme data": | 160 case "scheme data": |
| 161 if ("?" == c) { | 161 if ("?" == c) { |
| 162 this._query = "?"; | 162 this._query = "?"; |
| 163 state = "query"; | 163 state = "query"; |
| 164 } else if ("#" == c) { | 164 } else if ("#" == c) { |
| 165 this._fragment = "#"; | 165 this._fragment = "#"; |
| 166 state = "fragment"; | 166 state = "fragment"; |
| 167 } else { | 167 } else { |
| 168 if (EOF != c && "» " != c && "\n" != c && "\r" != c) { | 168 if (EOF != c && "\t" != c && "\n" != c && "\r" != c) { |
| 169 this._schemeData += percentEscape(c); | 169 this._schemeData += percentEscape(c); |
| 170 } | 170 } |
| 171 } | 171 } |
| 172 break; | 172 break; |
| 173 | 173 |
| 174 case "no scheme": | 174 case "no scheme": |
| 175 if (!base || !isRelativeScheme(base._scheme)) { | 175 if (!base || !isRelativeScheme(base._scheme)) { |
| 176 err("Missing scheme."); | 176 err("Missing scheme."); |
| 177 invalid.call(this); | 177 invalid.call(this); |
| 178 } else { | 178 } else { |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 | 289 |
| 290 case "authority": | 290 case "authority": |
| 291 if ("@" == c) { | 291 if ("@" == c) { |
| 292 if (seenAt) { | 292 if (seenAt) { |
| 293 err("@ already seen."); | 293 err("@ already seen."); |
| 294 buffer += "%40"; | 294 buffer += "%40"; |
| 295 } | 295 } |
| 296 seenAt = true; | 296 seenAt = true; |
| 297 for (var i = 0; i < buffer.length; i++) { | 297 for (var i = 0; i < buffer.length; i++) { |
| 298 var cp = buffer[i]; | 298 var cp = buffer[i]; |
| 299 if ("» " == cp || "\n" == cp || "\r" == cp) { | 299 if ("\t" == cp || "\n" == cp || "\r" == cp) { |
| 300 err("Invalid whitespace in authority."); | 300 err("Invalid whitespace in authority."); |
| 301 continue; | 301 continue; |
| 302 } | 302 } |
| 303 if (":" == cp && null === this._password) { | 303 if (":" == cp && null === this._password) { |
| 304 this._password = ""; | 304 this._password = ""; |
| 305 continue; | 305 continue; |
| 306 } | 306 } |
| 307 var tempC = percentEscape(cp); | 307 var tempC = percentEscape(cp); |
| 308 null !== this._password ? this._password += tempC : this._username +
= tempC; | 308 null !== this._password ? this._password += tempC : this._username +
= tempC; |
| 309 } | 309 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 323 if (buffer.length == 2 && ALPHA.test(buffer[0]) && (buffer[1] == ":" |
| buffer[1] == "|")) { | 323 if (buffer.length == 2 && ALPHA.test(buffer[0]) && (buffer[1] == ":" |
| buffer[1] == "|")) { |
| 324 state = "relative path"; | 324 state = "relative path"; |
| 325 } else if (buffer.length == 0) { | 325 } else if (buffer.length == 0) { |
| 326 state = "relative path start"; | 326 state = "relative path start"; |
| 327 } else { | 327 } else { |
| 328 this._host = IDNAToASCII.call(this, buffer); | 328 this._host = IDNAToASCII.call(this, buffer); |
| 329 buffer = ""; | 329 buffer = ""; |
| 330 state = "relative path start"; | 330 state = "relative path start"; |
| 331 } | 331 } |
| 332 continue; | 332 continue; |
| 333 } else if ("» " == c || "\n" == c || "\r" == c) { | 333 } else if ("\t" == c || "\n" == c || "\r" == c) { |
| 334 err("Invalid whitespace in file host."); | 334 err("Invalid whitespace in file host."); |
| 335 } else { | 335 } else { |
| 336 buffer += c; | 336 buffer += c; |
| 337 } | 337 } |
| 338 break; | 338 break; |
| 339 | 339 |
| 340 case "host": | 340 case "host": |
| 341 case "hostname": | 341 case "hostname": |
| 342 if (":" == c && !seenBracket) { | 342 if (":" == c && !seenBracket) { |
| 343 this._host = IDNAToASCII.call(this, buffer); | 343 this._host = IDNAToASCII.call(this, buffer); |
| 344 buffer = ""; | 344 buffer = ""; |
| 345 state = "port"; | 345 state = "port"; |
| 346 if ("hostname" == stateOverride) { | 346 if ("hostname" == stateOverride) { |
| 347 break loop; | 347 break loop; |
| 348 } | 348 } |
| 349 } else if (EOF == c || "/" == c || "\\" == c || "?" == c || "#" == c) { | 349 } else if (EOF == c || "/" == c || "\\" == c || "?" == c || "#" == c) { |
| 350 this._host = IDNAToASCII.call(this, buffer); | 350 this._host = IDNAToASCII.call(this, buffer); |
| 351 buffer = ""; | 351 buffer = ""; |
| 352 state = "relative path start"; | 352 state = "relative path start"; |
| 353 if (stateOverride) { | 353 if (stateOverride) { |
| 354 break loop; | 354 break loop; |
| 355 } | 355 } |
| 356 continue; | 356 continue; |
| 357 } else if ("» " != c && "\n" != c && "\r" != c) { | 357 } else if ("\t" != c && "\n" != c && "\r" != c) { |
| 358 if ("[" == c) { | 358 if ("[" == c) { |
| 359 seenBracket = true; | 359 seenBracket = true; |
| 360 } else if ("]" == c) { | 360 } else if ("]" == c) { |
| 361 seenBracket = false; | 361 seenBracket = false; |
| 362 } | 362 } |
| 363 buffer += c; | 363 buffer += c; |
| 364 } else { | 364 } else { |
| 365 err("Invalid code point in host/hostname: " + c); | 365 err("Invalid code point in host/hostname: " + c); |
| 366 } | 366 } |
| 367 break; | 367 break; |
| 368 | 368 |
| 369 case "port": | 369 case "port": |
| 370 if (/[0-9]/.test(c)) { | 370 if (/[0-9]/.test(c)) { |
| 371 buffer += c; | 371 buffer += c; |
| 372 } else if (EOF == c || "/" == c || "\\" == c || "?" == c || "#" == c ||
stateOverride) { | 372 } else if (EOF == c || "/" == c || "\\" == c || "?" == c || "#" == c ||
stateOverride) { |
| 373 if ("" != buffer) { | 373 if ("" != buffer) { |
| 374 var temp = parseInt(buffer, 10); | 374 var temp = parseInt(buffer, 10); |
| 375 if (temp != relative[this._scheme]) { | 375 if (temp != relative[this._scheme]) { |
| 376 this._port = temp + ""; | 376 this._port = temp + ""; |
| 377 } | 377 } |
| 378 buffer = ""; | 378 buffer = ""; |
| 379 } | 379 } |
| 380 if (stateOverride) { | 380 if (stateOverride) { |
| 381 break loop; | 381 break loop; |
| 382 } | 382 } |
| 383 state = "relative path start"; | 383 state = "relative path start"; |
| 384 continue; | 384 continue; |
| 385 } else if ("» " == c || "\n" == c || "\r" == c) { | 385 } else if ("\t" == c || "\n" == c || "\r" == c) { |
| 386 err("Invalid code point in port: " + c); | 386 err("Invalid code point in port: " + c); |
| 387 } else { | 387 } else { |
| 388 invalid.call(this); | 388 invalid.call(this); |
| 389 } | 389 } |
| 390 break; | 390 break; |
| 391 | 391 |
| 392 case "relative path start": | 392 case "relative path start": |
| 393 if ("\\" == c) err("'\\' not allowed in path."); | 393 if ("\\" == c) err("'\\' not allowed in path."); |
| 394 state = "relative path"; | 394 state = "relative path"; |
| 395 if ("/" != c && "\\" != c) { | 395 if ("/" != c && "\\" != c) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 420 this._path.push(buffer); | 420 this._path.push(buffer); |
| 421 } | 421 } |
| 422 buffer = ""; | 422 buffer = ""; |
| 423 if ("?" == c) { | 423 if ("?" == c) { |
| 424 this._query = "?"; | 424 this._query = "?"; |
| 425 state = "query"; | 425 state = "query"; |
| 426 } else if ("#" == c) { | 426 } else if ("#" == c) { |
| 427 this._fragment = "#"; | 427 this._fragment = "#"; |
| 428 state = "fragment"; | 428 state = "fragment"; |
| 429 } | 429 } |
| 430 } else if ("» " != c && "\n" != c && "\r" != c) { | 430 } else if ("\t" != c && "\n" != c && "\r" != c) { |
| 431 buffer += percentEscape(c); | 431 buffer += percentEscape(c); |
| 432 } | 432 } |
| 433 break; | 433 break; |
| 434 | 434 |
| 435 case "query": | 435 case "query": |
| 436 if (!stateOverride && "#" == c) { | 436 if (!stateOverride && "#" == c) { |
| 437 this._fragment = "#"; | 437 this._fragment = "#"; |
| 438 state = "fragment"; | 438 state = "fragment"; |
| 439 } else if (EOF != c && "» " != c && "\n" != c && "\r" != c) { | 439 } else if (EOF != c && "\t" != c && "\n" != c && "\r" != c) { |
| 440 this._query += percentEscapeQuery(c); | 440 this._query += percentEscapeQuery(c); |
| 441 } | 441 } |
| 442 break; | 442 break; |
| 443 | 443 |
| 444 case "fragment": | 444 case "fragment": |
| 445 if (EOF != c && "» " != c && "\n" != c && "\r" != c) { | 445 if (EOF != c && "\t" != c && "\n" != c && "\r" != c) { |
| 446 this._fragment += c; | 446 this._fragment += c; |
| 447 } | 447 } |
| 448 break; | 448 break; |
| 449 } | 449 } |
| 450 cursor++; | 450 cursor++; |
| 451 } | 451 } |
| 452 } | 452 } |
| 453 function clear() { | 453 function clear() { |
| 454 this._scheme = ""; | 454 this._scheme = ""; |
| 455 this._schemeData = ""; | 455 this._schemeData = ""; |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 907 }; | 907 }; |
| 908 global.JsMutationObserver = JsMutationObserver; | 908 global.JsMutationObserver = JsMutationObserver; |
| 909 if (!global.MutationObserver) { | 909 if (!global.MutationObserver) { |
| 910 global.MutationObserver = JsMutationObserver; | 910 global.MutationObserver = JsMutationObserver; |
| 911 JsMutationObserver._isPolyfilled = true; | 911 JsMutationObserver._isPolyfilled = true; |
| 912 } | 912 } |
| 913 })(self); | 913 })(self); |
| 914 | 914 |
| 915 (function() { | 915 (function() { |
| 916 var needsTemplate = typeof HTMLTemplateElement === "undefined"; | 916 var needsTemplate = typeof HTMLTemplateElement === "undefined"; |
| 917 if (/Trident/.test(navigator.userAgent)) { |
| 918 (function() { |
| 919 var importNode = document.importNode; |
| 920 document.importNode = function() { |
| 921 var n = importNode.apply(document, arguments); |
| 922 if (n.nodeType === Node.DOCUMENT_FRAGMENT_NODE) { |
| 923 var f = document.createDocumentFragment(); |
| 924 f.appendChild(n); |
| 925 return f; |
| 926 } else { |
| 927 return n; |
| 928 } |
| 929 }; |
| 930 })(); |
| 931 } |
| 917 var needsCloning = function() { | 932 var needsCloning = function() { |
| 918 if (!needsTemplate) { | 933 if (!needsTemplate) { |
| 919 var frag = document.createDocumentFragment(); | |
| 920 var t = document.createElement("template"); | 934 var t = document.createElement("template"); |
| 921 frag.appendChild(t); | 935 var t2 = document.createElement("template"); |
| 922 t.content.appendChild(document.createElement("div")); | 936 t2.content.appendChild(document.createElement("div")); |
| 923 var clone = frag.cloneNode(true); | 937 t.content.appendChild(t2); |
| 924 return clone.firstChild.content.childNodes.length === 0; | 938 var clone = t.cloneNode(true); |
| 939 return clone.content.childNodes.length === 0 || clone.content.firstChild.c
ontent.childNodes.length === 0; |
| 925 } | 940 } |
| 926 }(); | 941 }(); |
| 927 var TEMPLATE_TAG = "template"; | 942 var TEMPLATE_TAG = "template"; |
| 928 var TemplateImpl = function() {}; | 943 var TemplateImpl = function() {}; |
| 929 if (needsTemplate) { | 944 if (needsTemplate) { |
| 930 var contentDoc = document.implementation.createHTMLDocument("template"); | 945 var contentDoc = document.implementation.createHTMLDocument("template"); |
| 931 var canDecorate = true; | 946 var canDecorate = true; |
| 932 var templateStyle = document.createElement("style"); | 947 var templateStyle = document.createElement("style"); |
| 933 templateStyle.textContent = TEMPLATE_TAG + "{display:none;}"; | 948 templateStyle.textContent = TEMPLATE_TAG + "{display:none;}"; |
| 934 var head = document.head; | 949 var head = document.head; |
| 935 head.insertBefore(templateStyle, head.firstElementChild); | 950 head.insertBefore(templateStyle, head.firstElementChild); |
| 936 TemplateImpl.prototype = Object.create(HTMLElement.prototype); | 951 TemplateImpl.prototype = Object.create(HTMLElement.prototype); |
| 937 TemplateImpl.decorate = function(template) { | 952 TemplateImpl.decorate = function(template) { |
| 938 if (template.content) { | 953 if (template.content) { |
| 939 return; | 954 return; |
| 940 } | 955 } |
| 941 template.content = contentDoc.createDocumentFragment(); | 956 template.content = contentDoc.createDocumentFragment(); |
| 942 var child; | 957 var child; |
| 943 while (child = template.firstChild) { | 958 while (child = template.firstChild) { |
| 944 template.content.appendChild(child); | 959 template.content.appendChild(child); |
| 945 } | 960 } |
| 961 template.cloneNode = function(deep) { |
| 962 return TemplateImpl.cloneNode(this, deep); |
| 963 }; |
| 946 if (canDecorate) { | 964 if (canDecorate) { |
| 947 try { | 965 try { |
| 948 Object.defineProperty(template, "innerHTML", { | 966 Object.defineProperty(template, "innerHTML", { |
| 949 get: function() { | 967 get: function() { |
| 950 var o = ""; | 968 var o = ""; |
| 951 for (var e = this.content.firstChild; e; e = e.nextSibling) { | 969 for (var e = this.content.firstChild; e; e = e.nextSibling) { |
| 952 o += e.outerHTML || escapeData(e.data); | 970 o += e.outerHTML || escapeData(e.data); |
| 953 } | 971 } |
| 954 return o; | 972 return o; |
| 955 }, | 973 }, |
| 956 set: function(text) { | 974 set: function(text) { |
| 957 contentDoc.body.innerHTML = text; | 975 contentDoc.body.innerHTML = text; |
| 958 TemplateImpl.bootstrap(contentDoc); | 976 TemplateImpl.bootstrap(contentDoc); |
| 959 while (this.content.firstChild) { | 977 while (this.content.firstChild) { |
| 960 this.content.removeChild(this.content.firstChild); | 978 this.content.removeChild(this.content.firstChild); |
| 961 } | 979 } |
| 962 while (contentDoc.body.firstChild) { | 980 while (contentDoc.body.firstChild) { |
| 963 this.content.appendChild(contentDoc.body.firstChild); | 981 this.content.appendChild(contentDoc.body.firstChild); |
| 964 } | 982 } |
| 965 }, | 983 }, |
| 966 configurable: true | 984 configurable: true |
| 967 }); | 985 }); |
| 968 template.cloneNode = function(deep) { | |
| 969 return TemplateImpl.cloneNode(this, deep); | |
| 970 }; | |
| 971 } catch (err) { | 986 } catch (err) { |
| 972 canDecorate = false; | 987 canDecorate = false; |
| 973 } | 988 } |
| 974 } | 989 } |
| 975 TemplateImpl.bootstrap(template.content); | 990 TemplateImpl.bootstrap(template.content); |
| 976 }; | 991 }; |
| 977 TemplateImpl.bootstrap = function(doc) { | 992 TemplateImpl.bootstrap = function(doc) { |
| 978 var templates = doc.querySelectorAll(TEMPLATE_TAG); | 993 var templates = doc.querySelectorAll(TEMPLATE_TAG); |
| 979 for (var i = 0, l = templates.length, t; i < l && (t = templates[i]); i++)
{ | 994 for (var i = 0, l = templates.length, t; i < l && (t = templates[i]); i++)
{ |
| 980 TemplateImpl.decorate(t); | 995 TemplateImpl.decorate(t); |
| 981 } | 996 } |
| 982 }; | 997 }; |
| 983 document.addEventListener("DOMContentLoaded", function() { | 998 document.addEventListener("DOMContentLoaded", function() { |
| 984 TemplateImpl.bootstrap(document); | 999 TemplateImpl.bootstrap(document); |
| 985 }); | 1000 }); |
| 986 var createElement = document.createElement; | 1001 var createElement = document.createElement; |
| 987 document.createElement = function() { | 1002 document.createElement = function() { |
| 988 "use strict"; | 1003 "use strict"; |
| 989 var el = createElement.apply(document, arguments); | 1004 var el = createElement.apply(document, arguments); |
| 990 if (el.localName == "template") { | 1005 if (el.localName === "template") { |
| 991 TemplateImpl.decorate(el); | 1006 TemplateImpl.decorate(el); |
| 992 } | 1007 } |
| 993 return el; | 1008 return el; |
| 994 }; | 1009 }; |
| 995 var escapeDataRegExp = /[&\u00A0<>]/g; | 1010 var escapeDataRegExp = /[&\u00A0<>]/g; |
| 996 function escapeReplace(c) { | 1011 function escapeReplace(c) { |
| 997 switch (c) { | 1012 switch (c) { |
| 998 case "&": | 1013 case "&": |
| 999 return "&"; | 1014 return "&"; |
| 1000 | 1015 |
| 1001 case "<": | 1016 case "<": |
| 1002 return "<"; | 1017 return "<"; |
| 1003 | 1018 |
| 1004 case ">": | 1019 case ">": |
| 1005 return ">"; | 1020 return ">"; |
| 1006 | 1021 |
| 1007 case " ": | 1022 case " ": |
| 1008 return " "; | 1023 return " "; |
| 1009 } | 1024 } |
| 1010 } | 1025 } |
| 1011 function escapeData(s) { | 1026 function escapeData(s) { |
| 1012 return s.replace(escapeDataRegExp, escapeReplace); | 1027 return s.replace(escapeDataRegExp, escapeReplace); |
| 1013 } | 1028 } |
| 1014 } | 1029 } |
| 1015 if (needsTemplate || needsCloning) { | 1030 if (needsTemplate || needsCloning) { |
| 1016 var nativeCloneNode = Node.prototype.cloneNode; | 1031 var nativeCloneNode = Node.prototype.cloneNode; |
| 1017 TemplateImpl.cloneNode = function(template, deep) { | 1032 TemplateImpl.cloneNode = function(template, deep) { |
| 1018 var clone = nativeCloneNode.call(template); | 1033 var clone = nativeCloneNode.call(template, false); |
| 1019 if (this.decorate) { | 1034 if (this.decorate) { |
| 1020 this.decorate(clone); | 1035 this.decorate(clone); |
| 1021 } | 1036 } |
| 1022 if (deep) { | 1037 if (deep) { |
| 1023 clone.content.appendChild(nativeCloneNode.call(template.content, true)); | 1038 clone.content.appendChild(nativeCloneNode.call(template.content, true)); |
| 1024 this.fixClonedDom(clone.content, template.content); | 1039 this.fixClonedDom(clone.content, template.content); |
| 1025 } | 1040 } |
| 1026 return clone; | 1041 return clone; |
| 1027 }; | 1042 }; |
| 1028 TemplateImpl.fixClonedDom = function(clone, source) { | 1043 TemplateImpl.fixClonedDom = function(clone, source) { |
| 1044 if (!source.querySelectorAll) return; |
| 1029 var s$ = source.querySelectorAll(TEMPLATE_TAG); | 1045 var s$ = source.querySelectorAll(TEMPLATE_TAG); |
| 1030 var t$ = clone.querySelectorAll(TEMPLATE_TAG); | 1046 var t$ = clone.querySelectorAll(TEMPLATE_TAG); |
| 1031 for (var i = 0, l = t$.length, t, s; i < l; i++) { | 1047 for (var i = 0, l = t$.length, t, s; i < l; i++) { |
| 1032 s = s$[i]; | 1048 s = s$[i]; |
| 1033 t = t$[i]; | 1049 t = t$[i]; |
| 1034 if (this.decorate) { | 1050 if (this.decorate) { |
| 1035 this.decorate(s); | 1051 this.decorate(s); |
| 1036 } | 1052 } |
| 1037 t.parentNode.replaceChild(s.cloneNode(true), t); | 1053 t.parentNode.replaceChild(s.cloneNode(true), t); |
| 1038 } | 1054 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1056 return dom; | 1072 return dom; |
| 1057 } | 1073 } |
| 1058 }; | 1074 }; |
| 1059 if (needsCloning) { | 1075 if (needsCloning) { |
| 1060 HTMLTemplateElement.prototype.cloneNode = function(deep) { | 1076 HTMLTemplateElement.prototype.cloneNode = function(deep) { |
| 1061 return TemplateImpl.cloneNode(this, deep); | 1077 return TemplateImpl.cloneNode(this, deep); |
| 1062 }; | 1078 }; |
| 1063 } | 1079 } |
| 1064 } | 1080 } |
| 1065 if (needsTemplate) { | 1081 if (needsTemplate) { |
| 1066 HTMLTemplateElement = TemplateImpl; | 1082 window.HTMLTemplateElement = TemplateImpl; |
| 1067 } | 1083 } |
| 1068 })(); | 1084 })(); |
| 1069 | 1085 |
| 1070 (function(scope) { | 1086 (function(scope) { |
| 1071 "use strict"; | 1087 "use strict"; |
| 1072 if (!window.performance) { | 1088 if (!(window.performance && window.performance.now)) { |
| 1073 var start = Date.now(); | 1089 var start = Date.now(); |
| 1074 window.performance = { | 1090 window.performance = { |
| 1075 now: function() { | 1091 now: function() { |
| 1076 return Date.now() - start; | 1092 return Date.now() - start; |
| 1077 } | 1093 } |
| 1078 }; | 1094 }; |
| 1079 } | 1095 } |
| 1080 if (!window.requestAnimationFrame) { | 1096 if (!window.requestAnimationFrame) { |
| 1081 window.requestAnimationFrame = function() { | 1097 window.requestAnimationFrame = function() { |
| 1082 var nativeRaf = window.webkitRequestAnimationFrame || window.mozRequestAni
mationFrame; | 1098 var nativeRaf = window.webkitRequestAnimationFrame || window.mozRequestAni
mationFrame; |
| (...skipping 1141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2224 if (isReservedTag(name)) { | 2240 if (isReservedTag(name)) { |
| 2225 throw new Error("Failed to execute 'registerElement' on 'Document': Regist
ration failed for type '" + String(name) + "'. The type name is invalid."); | 2241 throw new Error("Failed to execute 'registerElement' on 'Document': Regist
ration failed for type '" + String(name) + "'. The type name is invalid."); |
| 2226 } | 2242 } |
| 2227 if (getRegisteredDefinition(name)) { | 2243 if (getRegisteredDefinition(name)) { |
| 2228 throw new Error("DuplicateDefinitionError: a type with name '" + String(na
me) + "' is already registered"); | 2244 throw new Error("DuplicateDefinitionError: a type with name '" + String(na
me) + "' is already registered"); |
| 2229 } | 2245 } |
| 2230 if (!definition.prototype) { | 2246 if (!definition.prototype) { |
| 2231 definition.prototype = Object.create(HTMLElement.prototype); | 2247 definition.prototype = Object.create(HTMLElement.prototype); |
| 2232 } | 2248 } |
| 2233 definition.__name = name.toLowerCase(); | 2249 definition.__name = name.toLowerCase(); |
| 2250 if (definition.extends) { |
| 2251 definition.extends = definition.extends.toLowerCase(); |
| 2252 } |
| 2234 definition.lifecycle = definition.lifecycle || {}; | 2253 definition.lifecycle = definition.lifecycle || {}; |
| 2235 definition.ancestry = ancestry(definition.extends); | 2254 definition.ancestry = ancestry(definition.extends); |
| 2236 resolveTagName(definition); | 2255 resolveTagName(definition); |
| 2237 resolvePrototypeChain(definition); | 2256 resolvePrototypeChain(definition); |
| 2238 overrideAttributeApi(definition.prototype); | 2257 overrideAttributeApi(definition.prototype); |
| 2239 registerDefinition(definition.__name, definition); | 2258 registerDefinition(definition.__name, definition); |
| 2240 definition.ctor = generateConstructor(definition); | 2259 definition.ctor = generateConstructor(definition); |
| 2241 definition.ctor.prototype = definition.prototype; | 2260 definition.ctor.prototype = definition.prototype; |
| 2242 definition.prototype.constructor = definition.ctor; | 2261 definition.prototype.constructor = definition.ctor; |
| 2243 if (scope.ready) { | 2262 if (scope.ready) { |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2396 function wrapDomMethodToForceUpgrade(obj, methodName) { | 2415 function wrapDomMethodToForceUpgrade(obj, methodName) { |
| 2397 var orig = obj[methodName]; | 2416 var orig = obj[methodName]; |
| 2398 obj[methodName] = function() { | 2417 obj[methodName] = function() { |
| 2399 var n = orig.apply(this, arguments); | 2418 var n = orig.apply(this, arguments); |
| 2400 upgradeAll(n); | 2419 upgradeAll(n); |
| 2401 return n; | 2420 return n; |
| 2402 }; | 2421 }; |
| 2403 } | 2422 } |
| 2404 wrapDomMethodToForceUpgrade(Node.prototype, "cloneNode"); | 2423 wrapDomMethodToForceUpgrade(Node.prototype, "cloneNode"); |
| 2405 wrapDomMethodToForceUpgrade(document, "importNode"); | 2424 wrapDomMethodToForceUpgrade(document, "importNode"); |
| 2406 if (isIE) { | |
| 2407 (function() { | |
| 2408 var importNode = document.importNode; | |
| 2409 document.importNode = function() { | |
| 2410 var n = importNode.apply(document, arguments); | |
| 2411 if (n.nodeType == n.DOCUMENT_FRAGMENT_NODE) { | |
| 2412 var f = document.createDocumentFragment(); | |
| 2413 f.appendChild(n); | |
| 2414 return f; | |
| 2415 } else { | |
| 2416 return n; | |
| 2417 } | |
| 2418 }; | |
| 2419 })(); | |
| 2420 } | |
| 2421 document.registerElement = register; | 2425 document.registerElement = register; |
| 2422 document.createElement = createElement; | 2426 document.createElement = createElement; |
| 2423 document.createElementNS = createElementNS; | 2427 document.createElementNS = createElementNS; |
| 2424 scope.registry = registry; | 2428 scope.registry = registry; |
| 2425 scope.instanceof = isInstance; | 2429 scope.instanceof = isInstance; |
| 2426 scope.reservedTagList = reservedTagList; | 2430 scope.reservedTagList = reservedTagList; |
| 2427 scope.getRegisteredDefinition = getRegisteredDefinition; | 2431 scope.getRegisteredDefinition = getRegisteredDefinition; |
| 2428 document.register = document.registerElement; | 2432 document.register = document.registerElement; |
| 2429 }); | 2433 }); |
| 2430 | 2434 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2492 window.addEventListener(loadEvent, bootstrap); | 2496 window.addEventListener(loadEvent, bootstrap); |
| 2493 } | 2497 } |
| 2494 })(window.CustomElements); | 2498 })(window.CustomElements); |
| 2495 | 2499 |
| 2496 (function(scope) { | 2500 (function(scope) { |
| 2497 var style = document.createElement("style"); | 2501 var style = document.createElement("style"); |
| 2498 style.textContent = "" + "body {" + "transition: opacity ease-in 0.2s;" + " }
\n" + "body[unresolved] {" + "opacity: 0; display: block; overflow: hidden; posi
tion: relative;" + " } \n"; | 2502 style.textContent = "" + "body {" + "transition: opacity ease-in 0.2s;" + " }
\n" + "body[unresolved] {" + "opacity: 0; display: block; overflow: hidden; posi
tion: relative;" + " } \n"; |
| 2499 var head = document.querySelector("head"); | 2503 var head = document.querySelector("head"); |
| 2500 head.insertBefore(style, head.firstChild); | 2504 head.insertBefore(style, head.firstChild); |
| 2501 })(window.WebComponents); | 2505 })(window.WebComponents); |
| OLD | NEW |