| OLD | NEW |
| (Empty) | |
| 1 /** |
| 2 * @license |
| 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 |
| 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 |
| 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 |
| 9 */ |
| 10 |
| 11 (function() { |
| 12 |
| 13 'use strict'; |
| 14 |
| 15 // Establish scope. |
| 16 window['WebComponents'] = window['WebComponents'] || {'flags':{}}; |
| 17 |
| 18 // loading script |
| 19 var file = 'webcomponents-lite.js'; |
| 20 var script = document.querySelector('script[src*="' + file + '"]'); |
| 21 var flagMatcher = /wc-(.+)/; |
| 22 |
| 23 // Flags. Convert url arguments to flags |
| 24 var flags = {}; |
| 25 if (!flags['noOpts']) { |
| 26 // from url |
| 27 location.search.slice(1).split('&').forEach(function(option) { |
| 28 var parts = option.split('='); |
| 29 var match; |
| 30 if (parts[0] && (match = parts[0].match(flagMatcher))) { |
| 31 flags[match[1]] = parts[1] || true; |
| 32 } |
| 33 }); |
| 34 // from script |
| 35 if (script) { |
| 36 for (var i=0, a; (a=script.attributes[i]); i++) { |
| 37 if (a.name !== 'src') { |
| 38 flags[a.name] = a.value || true; |
| 39 } |
| 40 } |
| 41 } |
| 42 // log flags |
| 43 if (flags['log'] && flags['log']['split']) { |
| 44 var parts = flags['log'].split(','); |
| 45 flags['log'] = {}; |
| 46 parts.forEach(function(f) { |
| 47 flags['log'][f] = true; |
| 48 }); |
| 49 } else { |
| 50 flags['log'] = {}; |
| 51 } |
| 52 } |
| 53 |
| 54 // exports |
| 55 window['WebComponents']['flags'] = flags; |
| 56 var forceShady = flags['shadydom']; |
| 57 if (forceShady) { |
| 58 window['ShadyDOM'] = window['ShadyDOM'] || {}; |
| 59 window['ShadyDOM']['force'] = forceShady; |
| 60 } |
| 61 |
| 62 var forceCE = flags['register'] || flags['ce']; |
| 63 if (forceCE && window['customElements']) { |
| 64 window['customElements']['forcePolyfill'] = forceCE; |
| 65 } |
| 66 |
| 67 })(); |
| OLD | NEW |