| 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.5.1-1 | 10 // @version 0.5.4 |
| 11 window.WebComponents = window.WebComponents || {}; | 11 window.WebComponents = window.WebComponents || {}; |
| 12 | 12 |
| 13 (function(scope) { | 13 (function(scope) { |
| 14 var flags = scope.flags || {}; | 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(o) { | 18 location.search.slice(1).split("&").forEach(function(o) { |
| 20 o = o.split("="); | 19 o = o.split("="); |
| 21 o[0] && (flags[o[0]] = o[1] || true); | 20 o[0] && (flags[o[0]] = o[1] || true); |
| 22 }); | 21 }); |
| 23 if (script) { | 22 if (script) { |
| 24 for (var i = 0, a; a = script.attributes[i]; i++) { | 23 for (var i = 0, a; a = script.attributes[i]; i++) { |
| 25 if (a.name !== "src") { | 24 if (a.name !== "src") { |
| 26 flags[a.name] = a.value || true; | 25 flags[a.name] = a.value || true; |
| 27 } | 26 } |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 var imports = document.querySelectorAll("link[rel=import]"); | 503 var imports = document.querySelectorAll("link[rel=import]"); |
| 505 for (var i = 0, l = imports.length, imp; i < l && (imp = imports[i]); i+
+) { | 504 for (var i = 0, l = imports.length, imp; i < l && (imp = imports[i]); i+
+) { |
| 506 handleImport(imp); | 505 handleImport(imp); |
| 507 } | 506 } |
| 508 } | 507 } |
| 509 })(); | 508 })(); |
| 510 } | 509 } |
| 511 whenReady(function() { | 510 whenReady(function() { |
| 512 HTMLImports.ready = true; | 511 HTMLImports.ready = true; |
| 513 HTMLImports.readyTime = new Date().getTime(); | 512 HTMLImports.readyTime = new Date().getTime(); |
| 514 rootDocument.dispatchEvent(new CustomEvent("HTMLImportsLoaded", { | 513 var evt = rootDocument.createEvent("CustomEvent"); |
| 515 bubbles: true | 514 evt.initCustomEvent("HTMLImportsLoaded", true, true, {}); |
| 516 })); | 515 rootDocument.dispatchEvent(evt); |
| 517 }); | 516 }); |
| 518 scope.IMPORT_LINK_TYPE = IMPORT_LINK_TYPE; | 517 scope.IMPORT_LINK_TYPE = IMPORT_LINK_TYPE; |
| 519 scope.useNative = useNative; | 518 scope.useNative = useNative; |
| 520 scope.rootDocument = rootDocument; | 519 scope.rootDocument = rootDocument; |
| 521 scope.whenReady = whenReady; | 520 scope.whenReady = whenReady; |
| 522 scope.isIE = isIE; | 521 scope.isIE = isIE; |
| 523 })(HTMLImports); | 522 })(HTMLImports); |
| 524 | 523 |
| 525 (function(scope) { | 524 (function(scope) { |
| 526 var modules = []; | 525 var modules = []; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 557 urlObj.href = urlPath; | 556 urlObj.href = urlPath; |
| 558 urlPath = urlObj.href; | 557 urlPath = urlObj.href; |
| 559 return pre + "'" + urlPath + "'" + post; | 558 return pre + "'" + urlPath + "'" + post; |
| 560 }); | 559 }); |
| 561 } | 560 } |
| 562 }; | 561 }; |
| 563 scope.path = path; | 562 scope.path = path; |
| 564 }); | 563 }); |
| 565 | 564 |
| 566 HTMLImports.addModule(function(scope) { | 565 HTMLImports.addModule(function(scope) { |
| 567 xhr = { | 566 var xhr = { |
| 568 async: true, | 567 async: true, |
| 569 ok: function(request) { | 568 ok: function(request) { |
| 570 return request.status >= 200 && request.status < 300 || request.status ===
304 || request.status === 0; | 569 return request.status >= 200 && request.status < 300 || request.status ===
304 || request.status === 0; |
| 571 }, | 570 }, |
| 572 load: function(url, next, nextContext) { | 571 load: function(url, next, nextContext) { |
| 573 var request = new XMLHttpRequest(); | 572 var request = new XMLHttpRequest(); |
| 574 if (scope.flags.debug || scope.flags.bust) { | 573 if (scope.flags.debug || scope.flags.bust) { |
| 575 url += "?" + Math.random(); | 574 url += "?" + Math.random(); |
| 576 } | 575 } |
| 577 request.open("GET", url, xhr.async); | 576 request.open("GET", url, xhr.async); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 if (this.cache[url]) { | 633 if (this.cache[url]) { |
| 635 this.onload(url, elt, this.cache[url]); | 634 this.onload(url, elt, this.cache[url]); |
| 636 this.tail(); | 635 this.tail(); |
| 637 return true; | 636 return true; |
| 638 } | 637 } |
| 639 this.pending[url] = [ elt ]; | 638 this.pending[url] = [ elt ]; |
| 640 return false; | 639 return false; |
| 641 }, | 640 }, |
| 642 fetch: function(url, elt) { | 641 fetch: function(url, elt) { |
| 643 flags.load && console.log("fetch", url, elt); | 642 flags.load && console.log("fetch", url, elt); |
| 644 if (url.match(/^data:/)) { | 643 if (!url) { |
| 644 setTimeout(function() { |
| 645 this.receive(url, elt, { |
| 646 error: "href must be specified" |
| 647 }, null); |
| 648 }.bind(this), 0); |
| 649 } else if (url.match(/^data:/)) { |
| 645 var pieces = url.split(","); | 650 var pieces = url.split(","); |
| 646 var header = pieces[0]; | 651 var header = pieces[0]; |
| 647 var body = pieces[1]; | 652 var body = pieces[1]; |
| 648 if (header.indexOf(";base64") > -1) { | 653 if (header.indexOf(";base64") > -1) { |
| 649 body = atob(body); | 654 body = atob(body); |
| 650 } else { | 655 } else { |
| 651 body = decodeURIComponent(body); | 656 body = decodeURIComponent(body); |
| 652 } | 657 } |
| 653 setTimeout(function() { | 658 setTimeout(function() { |
| 654 this.receive(url, elt, null, body); | 659 this.receive(url, elt, null, body); |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1038 } | 1043 } |
| 1039 scope.importer = importer; | 1044 scope.importer = importer; |
| 1040 scope.importLoader = importLoader; | 1045 scope.importLoader = importLoader; |
| 1041 }); | 1046 }); |
| 1042 | 1047 |
| 1043 HTMLImports.addModule(function(scope) { | 1048 HTMLImports.addModule(function(scope) { |
| 1044 var parser = scope.parser; | 1049 var parser = scope.parser; |
| 1045 var importer = scope.importer; | 1050 var importer = scope.importer; |
| 1046 var dynamic = { | 1051 var dynamic = { |
| 1047 added: function(nodes) { | 1052 added: function(nodes) { |
| 1048 var owner, parsed; | 1053 var owner, parsed, loading; |
| 1049 for (var i = 0, l = nodes.length, n; i < l && (n = nodes[i]); i++) { | 1054 for (var i = 0, l = nodes.length, n; i < l && (n = nodes[i]); i++) { |
| 1050 if (!owner) { | 1055 if (!owner) { |
| 1051 owner = n.ownerDocument; | 1056 owner = n.ownerDocument; |
| 1052 parsed = parser.isParsed(owner); | 1057 parsed = parser.isParsed(owner); |
| 1053 } | 1058 } |
| 1054 loading = this.shouldLoadNode(n); | 1059 loading = this.shouldLoadNode(n); |
| 1055 if (loading) { | 1060 if (loading) { |
| 1056 importer.loadNode(n); | 1061 importer.loadNode(n); |
| 1057 } | 1062 } |
| 1058 if (this.shouldParseNode(n) && parsed) { | 1063 if (this.shouldParseNode(n) && parsed) { |
| (...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1710 }); | 1715 }); |
| 1711 })(); | 1716 })(); |
| 1712 } | 1717 } |
| 1713 | 1718 |
| 1714 (function(scope) { | 1719 (function(scope) { |
| 1715 var style = document.createElement("style"); | 1720 var style = document.createElement("style"); |
| 1716 style.textContent = "" + "body {" + "transition: opacity ease-in 0.2s;" + " }
\n" + "body[unresolved] {" + "opacity: 0; display: block; overflow: hidden; posi
tion: relative;" + " } \n"; | 1721 style.textContent = "" + "body {" + "transition: opacity ease-in 0.2s;" + " }
\n" + "body[unresolved] {" + "opacity: 0; display: block; overflow: hidden; posi
tion: relative;" + " } \n"; |
| 1717 var head = document.querySelector("head"); | 1722 var head = document.querySelector("head"); |
| 1718 head.insertBefore(style, head.firstChild); | 1723 head.insertBefore(style, head.firstChild); |
| 1719 })(window.WebComponents); | 1724 })(window.WebComponents); |
| OLD | NEW |