diff --git a/build-native.json b/build-native.json index ef20b6f..077ac18 100644 --- a/build-native.json +++ b/build-native.json @@ -1,4 +1,5 @@ [ + "build/boot.js", "src/patches-shadowdom-native.js", "src/lang.js", diff --git a/build.json b/build.json index b3d0b80..3952e69 100644 --- a/build.json +++ b/build.json @@ -1,4 +1,5 @@ [ + "build/boot.js", "../WeakMap/weakmap.js", "../observe-js/src/observe.js", "build/if-poly.js", diff --git a/build/boot.js b/build/boot.js new file mode 100644 index 0000000..06e2397 --- /dev/null +++ b/build/boot.js @@ -0,0 +1,67 @@ +/** + * Copyright (c) 2014 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt + */ + +window.Platform = window.Platform || {}; +// prepopulate window.logFlags if necessary +window.logFlags = window.logFlags || {}; +// process flags +(function(scope){ + // import + var flags = scope.flags || {}; + // populate flags from location + location.search.slice(1).split('&').forEach(function(o) { + o = o.split('='); + o[0] && (flags[o[0]] = o[1] || true); + }); + var entryPoint = document.currentScript || + document.querySelector('script[src*="platform.js"]'); + if (entryPoint) { + var a = entryPoint.attributes; + for (var i = 0, n; i < a.length; i++) { + n = a[i]; + if (n.name !== 'src') { + flags[n.name] = n.value || true; + } + } + } + if (flags.log) { + flags.log.split(',').forEach(function(f) { + window.logFlags[f] = true; + }); + } + // If any of these flags match 'native', then force native ShadowDOM; any + // other truthy value, or failure to detect native + // ShadowDOM, results in polyfill + flags.shadow = flags.shadow || flags.shadowdom || flags.polyfill; + if (flags.shadow === 'native') { + flags.shadow = false; + } else { + flags.shadow = flags.shadow || !HTMLElement.prototype.createShadowRoot; + } + + if (flags.shadow && document.querySelectorAll('script').length > 1) { + console.warn('platform.js is not the first script on the page. ' + + 'See http://www.polymer-project.org/docs/start/platform.html#setup ' + + 'for details.'); + } + + // CustomElements polyfill flag + if (flags.register) { + window.CustomElements = window.CustomElements || {flags: {}}; + window.CustomElements.flags.register = flags.register; + } + + if (flags.imports) { + window.HTMLImports = window.HTMLImports || {flags: {}}; + window.HTMLImports.flags.imports = flags.imports; + } + + // export + scope.flags = flags; +})(Platform); diff --git a/build/if-poly.js b/build/if-poly.js index dc2a339..9e1f48a 100644 --- a/build/if-poly.js +++ b/build/if-poly.js @@ -1,62 +1,2 @@ -// prepoulate window.Platform.flags for default controls -window.Platform = window.Platform || {}; -// prepopulate window.logFlags if necessary -window.logFlags = window.logFlags || {}; -// process flags -(function(scope){ - // import - var flags = scope.flags || {}; - // populate flags from location - location.search.slice(1).split('&').forEach(function(o) { - o = o.split('='); - o[0] && (flags[o[0]] = o[1] || true); - }); - var entryPoint = document.currentScript || - document.querySelector('script[src*="platform.js"]'); - if (entryPoint) { - var a = entryPoint.attributes; - for (var i = 0, n; i < a.length; i++) { - n = a[i]; - if (n.name !== 'src') { - flags[n.name] = n.value || true; - } - } - } - if (flags.log) { - flags.log.split(',').forEach(function(f) { - window.logFlags[f] = true; - }); - } - // If any of these flags match 'native', then force native ShadowDOM; any - // other truthy value, or failure to detect native - // ShadowDOM, results in polyfill - flags.shadow = flags.shadow || flags.shadowdom || flags.polyfill; - if (flags.shadow === 'native') { - flags.shadow = false; - } else { - flags.shadow = flags.shadow || !HTMLElement.prototype.createShadowRoot; - } - - if (flags.shadow && document.querySelectorAll('script').length > 1) { - console.warn('platform.js is not the first script on the page. ' + - 'See http://www.polymer-project.org/docs/start/platform.html#setup ' + - 'for details.'); - } - - // CustomElements polyfill flag - if (flags.register) { - window.CustomElements = window.CustomElements || {flags: {}}; - window.CustomElements.flags.register = flags.register; - } - - if (flags.imports) { - window.HTMLImports = window.HTMLImports || {flags: {}}; - window.HTMLImports.flags.imports = flags.imports; - } - - // export - scope.flags = flags; -})(Platform); - // select ShadowDOM impl if (Platform.flags.shadow) {