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 window.PolymerGestures = {}; | 10 window.PolymerGestures = {}; |
(...skipping 3716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3727 | 3727 |
3728 /* | 3728 /* |
3729 * Copyright (c) 2014 The Polymer Project Authors. All rights reserved. | 3729 * Copyright (c) 2014 The Polymer Project Authors. All rights reserved. |
3730 * This code may only be used under the BSD style license found at http://polyme
r.github.io/LICENSE.txt | 3730 * This code may only be used under the BSD style license found at http://polyme
r.github.io/LICENSE.txt |
3731 * The complete set of authors may be found at http://polymer.github.io/AUTHORS.
txt | 3731 * The complete set of authors may be found at http://polymer.github.io/AUTHORS.
txt |
3732 * The complete set of contributors may be found at http://polymer.github.io/CON
TRIBUTORS.txt | 3732 * The complete set of contributors may be found at http://polymer.github.io/CON
TRIBUTORS.txt |
3733 * Code distributed by Google as part of the polymer project is also | 3733 * Code distributed by Google as part of the polymer project is also |
3734 * subject to an additional IP rights grant found at http://polymer.github.io/PA
TENTS.txt | 3734 * subject to an additional IP rights grant found at http://polymer.github.io/PA
TENTS.txt |
3735 */ | 3735 */ |
3736 Polymer = { | 3736 Polymer = { |
3737 version: '0.4.1-d61654b' | 3737 version: '0.4.2-8c339cf' |
3738 }; | 3738 }; |
3739 | 3739 |
3740 /* | 3740 /* |
3741 * Copyright (c) 2014 The Polymer Project Authors. All rights reserved. | 3741 * Copyright (c) 2014 The Polymer Project Authors. All rights reserved. |
3742 * This code may only be used under the BSD style license found at http://polyme
r.github.io/LICENSE.txt | 3742 * This code may only be used under the BSD style license found at http://polyme
r.github.io/LICENSE.txt |
3743 * The complete set of authors may be found at http://polymer.github.io/AUTHORS.
txt | 3743 * The complete set of authors may be found at http://polymer.github.io/AUTHORS.
txt |
3744 * The complete set of contributors may be found at http://polymer.github.io/CON
TRIBUTORS.txt | 3744 * The complete set of contributors may be found at http://polymer.github.io/CON
TRIBUTORS.txt |
3745 * Code distributed by Google as part of the polymer project is also | 3745 * Code distributed by Google as part of the polymer project is also |
3746 * subject to an additional IP rights grant found at http://polymer.github.io/PA
TENTS.txt | 3746 * subject to an additional IP rights grant found at http://polymer.github.io/PA
TENTS.txt |
3747 */ | 3747 */ |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3808 * Copyright (c) 2014 The Polymer Project Authors. All rights reserved. | 3808 * Copyright (c) 2014 The Polymer Project Authors. All rights reserved. |
3809 * This code may only be used under the BSD style license found at http://polyme
r.github.io/LICENSE.txt | 3809 * This code may only be used under the BSD style license found at http://polyme
r.github.io/LICENSE.txt |
3810 * The complete set of authors may be found at http://polymer.github.io/AUTHORS.
txt | 3810 * The complete set of authors may be found at http://polymer.github.io/AUTHORS.
txt |
3811 * The complete set of contributors may be found at http://polymer.github.io/CON
TRIBUTORS.txt | 3811 * The complete set of contributors may be found at http://polymer.github.io/CON
TRIBUTORS.txt |
3812 * Code distributed by Google as part of the polymer project is also | 3812 * Code distributed by Google as part of the polymer project is also |
3813 * subject to an additional IP rights grant found at http://polymer.github.io/PA
TENTS.txt | 3813 * subject to an additional IP rights grant found at http://polymer.github.io/PA
TENTS.txt |
3814 */ | 3814 */ |
3815 | 3815 |
3816 (function(scope) { | 3816 (function(scope) { |
3817 | 3817 |
3818 var hasNative = ('import' in document.createElement('link')); | 3818 var IMPORT_LINK_TYPE = 'import'; |
| 3819 var hasNative = (IMPORT_LINK_TYPE in document.createElement('link')); |
3819 var useNative = hasNative; | 3820 var useNative = hasNative; |
3820 | 3821 var isIE = /Trident/.test(navigator.userAgent); |
3821 isIE = /Trident/.test(navigator.userAgent); | |
3822 | 3822 |
3823 // TODO(sorvell): SD polyfill intrusion | 3823 // TODO(sorvell): SD polyfill intrusion |
3824 var hasShadowDOMPolyfill = Boolean(window.ShadowDOMPolyfill); | 3824 var hasShadowDOMPolyfill = Boolean(window.ShadowDOMPolyfill); |
3825 var wrap = function(node) { | 3825 var wrap = function(node) { |
3826 return hasShadowDOMPolyfill ? ShadowDOMPolyfill.wrapIfNeeded(node) : node; | 3826 return hasShadowDOMPolyfill ? ShadowDOMPolyfill.wrapIfNeeded(node) : node; |
3827 }; | 3827 }; |
3828 var mainDoc = wrap(document); | 3828 |
| 3829 var rootDocument = wrap(document); |
3829 | 3830 |
3830 // NOTE: We cannot polyfill document.currentScript because it's not possible | 3831 // NOTE: We cannot polyfill document.currentScript because it's not possible |
3831 // both to override and maintain the ability to capture the native value; | 3832 // both to override and maintain the ability to capture the native value; |
3832 // therefore we choose to expose _currentScript both when native imports | 3833 // therefore we choose to expose _currentScript both when native imports |
3833 // and the polyfill are in use. | 3834 // and the polyfill are in use. |
3834 var currentScriptDescriptor = { | 3835 var currentScriptDescriptor = { |
3835 get: function() { | 3836 get: function() { |
3836 var script = HTMLImports.currentScript || document.currentScript || | 3837 var script = HTMLImports.currentScript || document.currentScript || |
3837 // NOTE: only works when called in synchronously executing code. | 3838 // NOTE: only works when called in synchronously executing code. |
3838 // readyState should check if `loading` but IE10 is | 3839 // readyState should check if `loading` but IE10 is |
3839 // interactive when scripts run so we cheat. | 3840 // interactive when scripts run so we cheat. |
3840 (document.readyState !== 'complete' ? | 3841 (document.readyState !== 'complete' ? |
3841 document.scripts[document.scripts.length - 1] : null); | 3842 document.scripts[document.scripts.length - 1] : null); |
3842 return wrap(script); | 3843 return wrap(script); |
3843 }, | 3844 }, |
3844 configurable: true | 3845 configurable: true |
3845 }; | 3846 }; |
3846 | 3847 |
3847 Object.defineProperty(document, '_currentScript', currentScriptDescriptor); | 3848 Object.defineProperty(document, '_currentScript', currentScriptDescriptor); |
3848 Object.defineProperty(mainDoc, '_currentScript', currentScriptDescriptor); | 3849 Object.defineProperty(rootDocument, '_currentScript', currentScriptDescriptor); |
3849 | 3850 |
3850 // call a callback when all HTMLImports in the document at call (or at least | 3851 // call a callback when all HTMLImports in the document at call (or at least |
3851 // document ready) time have loaded. | 3852 // document ready) time have loaded. |
3852 // 1. ensure the document is in a ready state (has dom), then | 3853 // 1. ensure the document is in a ready state (has dom), then |
3853 // 2. watch for loading of imports and call callback when done | 3854 // 2. watch for loading of imports and call callback when done |
3854 function whenImportsReady(callback, doc) { | 3855 function whenReady(callback, doc) { |
3855 doc = doc || mainDoc; | 3856 doc = doc || rootDocument; |
3856 // if document is loading, wait and try again | 3857 // if document is loading, wait and try again |
3857 whenDocumentReady(function() { | 3858 whenDocumentReady(function() { |
3858 watchImportsLoad(callback, doc); | 3859 watchImportsLoad(callback, doc); |
3859 }, doc); | 3860 }, doc); |
3860 } | 3861 } |
3861 | 3862 |
3862 // call the callback when the document is in a ready state (has dom) | 3863 // call the callback when the document is in a ready state (has dom) |
3863 var requiredReadyState = isIE ? 'complete' : 'interactive'; | 3864 var requiredReadyState = isIE ? 'complete' : 'interactive'; |
3864 var READY_EVENT = 'readystatechange'; | 3865 var READY_EVENT = 'readystatechange'; |
3865 function isDocumentReady(doc) { | 3866 function isDocumentReady(doc) { |
(...skipping 19 matching lines...) Expand all Loading... |
3885 | 3886 |
3886 function markTargetLoaded(event) { | 3887 function markTargetLoaded(event) { |
3887 event.target.__loaded = true; | 3888 event.target.__loaded = true; |
3888 } | 3889 } |
3889 | 3890 |
3890 // call <callback> when we ensure all imports have loaded | 3891 // call <callback> when we ensure all imports have loaded |
3891 function watchImportsLoad(callback, doc) { | 3892 function watchImportsLoad(callback, doc) { |
3892 var imports = doc.querySelectorAll('link[rel=import]'); | 3893 var imports = doc.querySelectorAll('link[rel=import]'); |
3893 var loaded = 0, l = imports.length; | 3894 var loaded = 0, l = imports.length; |
3894 function checkDone(d) { | 3895 function checkDone(d) { |
3895 if (loaded == l) { | 3896 if ((loaded == l) && callback) { |
3896 callback && callback(); | 3897 callback(); |
3897 } | 3898 } |
3898 } | 3899 } |
3899 function loadedImport(e) { | 3900 function loadedImport(e) { |
3900 markTargetLoaded(e); | 3901 markTargetLoaded(e); |
3901 loaded++; | 3902 loaded++; |
3902 checkDone(); | 3903 checkDone(); |
3903 } | 3904 } |
3904 if (l) { | 3905 if (l) { |
3905 for (var i=0, imp; (i<l) && (imp=imports[i]); i++) { | 3906 for (var i=0, imp; (i<l) && (imp=imports[i]); i++) { |
3906 if (isImportLoaded(imp)) { | 3907 if (isImportLoaded(imp)) { |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3979 } | 3980 } |
3980 } | 3981 } |
3981 })(); | 3982 })(); |
3982 | 3983 |
3983 } | 3984 } |
3984 | 3985 |
3985 // Fire the 'HTMLImportsLoaded' event when imports in document at load time | 3986 // Fire the 'HTMLImportsLoaded' event when imports in document at load time |
3986 // have loaded. This event is required to simulate the script blocking | 3987 // have loaded. This event is required to simulate the script blocking |
3987 // behavior of native imports. A main document script that needs to be sure | 3988 // behavior of native imports. A main document script that needs to be sure |
3988 // imports have loaded should wait for this event. | 3989 // imports have loaded should wait for this event. |
3989 whenImportsReady(function() { | 3990 whenReady(function() { |
3990 HTMLImports.ready = true; | 3991 HTMLImports.ready = true; |
3991 HTMLImports.readyTime = new Date().getTime(); | 3992 HTMLImports.readyTime = new Date().getTime(); |
3992 mainDoc.dispatchEvent( | 3993 rootDocument.dispatchEvent( |
3993 new CustomEvent('HTMLImportsLoaded', {bubbles: true}) | 3994 new CustomEvent('HTMLImportsLoaded', {bubbles: true}) |
3994 ); | 3995 ); |
3995 }); | 3996 }); |
3996 | 3997 |
3997 // exports | 3998 // exports |
3998 scope.useNative = useNative; | 3999 scope.useNative = useNative; |
3999 scope.isImportLoaded = isImportLoaded; | 4000 scope.isImportLoaded = isImportLoaded; |
4000 scope.whenReady = whenImportsReady; | 4001 scope.whenReady = whenReady; |
| 4002 scope.rootDocument = rootDocument; |
| 4003 scope.IMPORT_LINK_TYPE = IMPORT_LINK_TYPE; |
4001 scope.isIE = isIE; | 4004 scope.isIE = isIE; |
4002 | 4005 |
4003 // deprecated | |
4004 scope.whenImportsReady = whenImportsReady; | |
4005 | |
4006 })(window.HTMLImports); | 4006 })(window.HTMLImports); |
4007 /* | 4007 /* |
4008 * Copyright (c) 2014 The Polymer Project Authors. All rights reserved. | 4008 * Copyright (c) 2014 The Polymer Project Authors. All rights reserved. |
4009 * This code may only be used under the BSD style license found at http://polyme
r.github.io/LICENSE.txt | 4009 * This code may only be used under the BSD style license found at http://polyme
r.github.io/LICENSE.txt |
4010 * The complete set of authors may be found at http://polymer.github.io/AUTHORS.
txt | 4010 * The complete set of authors may be found at http://polymer.github.io/AUTHORS.
txt |
4011 * The complete set of contributors may be found at http://polymer.github.io/CON
TRIBUTORS.txt | 4011 * The complete set of contributors may be found at http://polymer.github.io/CON
TRIBUTORS.txt |
4012 * Code distributed by Google as part of the polymer project is also | 4012 * Code distributed by Google as part of the polymer project is also |
4013 * subject to an additional IP rights grant found at http://polymer.github.io/PA
TENTS.txt | 4013 * subject to an additional IP rights grant found at http://polymer.github.io/PA
TENTS.txt |
4014 */ | 4014 */ |
4015 | 4015 |
(...skipping 5381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9397 function element(name, prototype) { | 9397 function element(name, prototype) { |
9398 if (typeof name !== 'string') { | 9398 if (typeof name !== 'string') { |
9399 var script = prototype || document._currentScript; | 9399 var script = prototype || document._currentScript; |
9400 prototype = name; | 9400 prototype = name; |
9401 name = script && script.parentNode && script.parentNode.getAttribute ? | 9401 name = script && script.parentNode && script.parentNode.getAttribute ? |
9402 script.parentNode.getAttribute('name') : ''; | 9402 script.parentNode.getAttribute('name') : ''; |
9403 if (!name) { | 9403 if (!name) { |
9404 throw 'Element name could not be inferred.'; | 9404 throw 'Element name could not be inferred.'; |
9405 } | 9405 } |
9406 } | 9406 } |
9407 if (getRegisteredPrototype[name]) { | 9407 if (getRegisteredPrototype(name)) { |
9408 throw 'Already registered (Polymer) prototype for element ' + name; | 9408 throw 'Already registered (Polymer) prototype for element ' + name; |
9409 } | 9409 } |
9410 // cache the prototype | 9410 // cache the prototype |
9411 registerPrototype(name, prototype); | 9411 registerPrototype(name, prototype); |
9412 // notify the registrar waiting for 'name', if any | 9412 // notify the registrar waiting for 'name', if any |
9413 notifyPrototype(name); | 9413 notifyPrototype(name); |
9414 } | 9414 } |
9415 | 9415 |
9416 // async prototype source | 9416 // async prototype source |
9417 | 9417 |
(...skipping 1251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10669 return document.contains(element) ? mainQueue : importQueue; | 10669 return document.contains(element) ? mainQueue : importQueue; |
10670 } | 10670 } |
10671 | 10671 |
10672 function nextQueued() { | 10672 function nextQueued() { |
10673 return importQueue.length ? importQueue[0] : mainQueue[0]; | 10673 return importQueue.length ? importQueue[0] : mainQueue[0]; |
10674 } | 10674 } |
10675 | 10675 |
10676 function whenReady(callback) { | 10676 function whenReady(callback) { |
10677 queue.waitToReady = true; | 10677 queue.waitToReady = true; |
10678 Platform.endOfMicrotask(function() { | 10678 Platform.endOfMicrotask(function() { |
10679 HTMLImports.whenImportsReady(function() { | 10679 HTMLImports.whenReady(function() { |
10680 queue.addReadyCallback(callback); | 10680 queue.addReadyCallback(callback); |
10681 queue.waitToReady = false; | 10681 queue.waitToReady = false; |
10682 queue.check(); | 10682 queue.check(); |
10683 }); | 10683 }); |
10684 }); | 10684 }); |
10685 } | 10685 } |
10686 | 10686 |
10687 /** | 10687 /** |
10688 Forces polymer to register any pending elements. Can be used to abort | 10688 Forces polymer to register any pending elements. Can be used to abort |
10689 waiting for elements that are partially defined. | 10689 waiting for elements that are partially defined. |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10972 prepareBinding.call(syntax, pathString, name, node); | 10972 prepareBinding.call(syntax, pathString, name, node); |
10973 }; | 10973 }; |
10974 return syntax; | 10974 return syntax; |
10975 } | 10975 } |
10976 | 10976 |
10977 }); | 10977 }); |
10978 | 10978 |
10979 })(); | 10979 })(); |
10980 | 10980 |
10981 //# sourceMappingURL=polymer.concat.js.map | 10981 //# sourceMappingURL=polymer.concat.js.map |
OLD | NEW |