|
1 | 1 | /** |
| 2 | + * @license |
2 | 3 | * Copyright (c) 2014 The Polymer Project Authors. All rights reserved. |
3 | 4 | * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt |
4 | 5 | * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
|
7 | 8 | * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt |
8 | 9 | */ |
9 | 10 |
|
10 | | -window.WebComponents = window.WebComponents || {}; |
| 11 | +(function() { |
11 | 12 |
|
12 | | -// process flags |
13 | | -(function(scope){ |
14 | | - |
15 | | - // import |
16 | | - var flags = scope.flags || {}; |
| 13 | + // Establish scope. |
| 14 | + window.WebComponents = window.WebComponents || {flags:{}}; |
17 | 15 |
|
| 16 | + // loading script |
18 | 17 | var file = 'webcomponents-lite.js'; |
19 | 18 | var script = document.querySelector('script[src*="' + file + '"]'); |
20 | 19 |
|
21 | 20 | // Flags. Convert url arguments to flags |
| 21 | + var flags = {}; |
22 | 22 | if (!flags.noOpts) { |
23 | 23 | // from url |
24 | 24 | location.search.slice(1).split('&').forEach(function(option) { |
@@ -48,23 +48,13 @@ window.WebComponents = window.WebComponents || {}; |
48 | 48 | } |
49 | 49 | } |
50 | 50 |
|
51 | | - // Determine default settings. |
52 | | - // If any of these flags match 'native', then force native ShadowDOM; any |
53 | | - // other truthy value, or failure to detect native |
54 | | - // ShadowDOM, results in polyfill |
55 | | - flags.shadow = (flags.shadow || flags.shadowdom || flags.polyfill); |
56 | | - if (flags.shadow === 'native') { |
57 | | - flags.shadow = false; |
58 | | - } else { |
59 | | - flags.shadow = flags.shadow || !HTMLElement.prototype.createShadowRoot; |
60 | | - } |
61 | | - |
62 | 51 | // forward flags |
63 | 52 | if (flags.register) { |
64 | 53 | window.CustomElements = window.CustomElements || {flags: {}}; |
65 | 54 | window.CustomElements.flags.register = flags.register; |
66 | 55 | } |
67 | 56 |
|
68 | | - // export |
69 | | - scope.flags = flags; |
70 | | -})(window.WebComponents); |
| 57 | + // exports |
| 58 | + WebComponents.flags = flags; |
| 59 | + |
| 60 | +})(); |
0 commit comments