diff --git a/src/CustomElements/CustomElements.js b/src/CustomElements/CustomElements.js index 8ef94e6..03f4008 100644 --- a/src/CustomElements/CustomElements.js +++ b/src/CustomElements/CustomElements.js @@ -16,9 +16,12 @@ window.CustomElements = window.CustomElements || {flags:{}}; // Flags. Convert url arguments to flags var flags = {}; if (!flags.noOpts) { - location.search.slice(1).split('&').forEach(function(o) { - o = o.split('='); - o[0] && (flags[o[0]] = o[1] || true); + location.search.slice(1).split('&').forEach(function(option) { + var parts = option.split('='); + var match; + if (parts[0] && (match = parts[0].match(/wc-(.+)/))) { + flags[match[1]] = parts[1] || true; + } }); } diff --git a/src/HTMLImports/HTMLImports.js b/src/HTMLImports/HTMLImports.js index 2b76f5d..2577c2a 100644 --- a/src/HTMLImports/HTMLImports.js +++ b/src/HTMLImports/HTMLImports.js @@ -16,9 +16,12 @@ window.HTMLImports = window.HTMLImports || {flags:{}}; // Flags. Convert url arguments to flags var flags = {}; if (!flags.noOpts) { - location.search.slice(1).split('&').forEach(function(o) { - o = o.split('='); - o[0] && (flags[o[0]] = o[1] || true); + location.search.slice(1).split('&').forEach(function(option) { + var parts = option.split('='); + var match; + if (parts[0] && (match = parts[0].match(/wc-(.+)/))) { + flags[match[1]] = parts[1] || true; + } }); } diff --git a/src/WebComponents/build/boot-lite.js b/src/WebComponents/build/boot-lite.js index 4c3a6f4..c1cbca6 100644 --- a/src/WebComponents/build/boot-lite.js +++ b/src/WebComponents/build/boot-lite.js @@ -11,19 +11,22 @@ window.WebComponents = window.WebComponents || {}; // process flags (function(scope){ - + // import var flags = scope.flags || {}; - + var file = 'webcomponents-lite.js'; var script = document.querySelector('script[src*="' + file + '"]'); // Flags. Convert url arguments to flags if (!flags.noOpts) { // from url - location.search.slice(1).split('&').forEach(function(o) { - o = o.split('='); - o[0] && (flags[o[0]] = o[1] || true); + location.search.slice(1).split('&').forEach(function(option) { + var parts = option.split('='); + var match; + if (parts[0] && (match = parts[0].match(/wc-(.+)/))) { + flags[match[1]] = parts[1] || true; + } }); // from script if (script) { @@ -48,7 +51,7 @@ window.WebComponents = window.WebComponents || {}; // Determine default settings. // If any of these flags match 'native', then force native ShadowDOM; any // other truthy value, or failure to detect native - // ShadowDOM, results in polyfill + // ShadowDOM, results in polyfill flags.shadow = (flags.shadow || flags.shadowdom || flags.polyfill); if (flags.shadow === 'native') { flags.shadow = false; diff --git a/src/WebComponents/build/boot.js b/src/WebComponents/build/boot.js index 54c662f..c15938a 100644 --- a/src/WebComponents/build/boot.js +++ b/src/WebComponents/build/boot.js @@ -21,9 +21,12 @@ window.WebComponents = window.WebComponents || {}; // Flags. Convert url arguments to flags if (!flags.noOpts) { // from url - location.search.slice(1).split('&').forEach(function(o) { - o = o.split('='); - o[0] && (flags[o[0]] = o[1] || true); + location.search.slice(1).split('&').forEach(function(option) { + var parts = option.split('='); + var match; + if (parts[0] && (match = parts[0].match(/wc-(.+)/))) { + flags[match[1]] = parts[1] || true; + } }); // from script if (script) { diff --git a/tests/ShadowCSS/tests.js b/tests/ShadowCSS/tests.js index 121ed1d..be7a483 100644 --- a/tests/ShadowCSS/tests.js +++ b/tests/ShadowCSS/tests.js @@ -10,19 +10,19 @@ htmlSuite('ShadowCss', function() { htmlTest('html/pseudo-scoping.html'); - htmlTest('html/pseudo-scoping.html?shadow'); + htmlTest('html/pseudo-scoping.html?wc-shadow'); htmlTest('html/pseudo-scoping-strict.html'); - htmlTest('html/pseudo-scoping-strict.html?shadow'); + htmlTest('html/pseudo-scoping-strict.html?wc-shadow'); htmlTest('html/polyfill-directive.html'); htmlTest('html/polyfill-rule.html'); htmlTest('html/colon-host.html'); - htmlTest('html/colon-host.html?shadow'); - htmlTest('html/combinators.html?shadow'); + htmlTest('html/colon-host.html?wc-shadow'); + htmlTest('html/combinators.html?wc-shadow'); htmlTest('html/combinators-shadow.html'); - htmlTest('html/combinators-shadow.html?shadow'); + htmlTest('html/combinators-shadow.html?wc-shadow'); htmlTest('html/compressed.html'); htmlTest('html/before-content.html'); - htmlTest('html/before-content.html?shadow'); + htmlTest('html/before-content.html?wc-shadow'); htmlTest('html/before-content.html'); htmlTest('html/style-import.html'); htmlTest('html/style-import-base-tag.html'); diff --git a/tests/WebComponents/tests.js b/tests/WebComponents/tests.js index c074ff5..cbdd85c 100644 --- a/tests/WebComponents/tests.js +++ b/tests/WebComponents/tests.js @@ -17,10 +17,10 @@ htmlSuite('loader and build', function() { htmlSuite('integration', function() { htmlTest('html/web-components.html'); htmlTest('html/smoke.html'); - htmlTest('html/smoke.html?shadow'); + htmlTest('html/smoke.html?wc-shadow'); htmlTest('html/ce-import.html'); htmlTest('html/ce-upgradedocumenttree.html'); - htmlTest('html/ce-import.html?shadow'); + htmlTest('html/ce-import.html?wc-shadow'); htmlTest('html/ce-upgrade-order.html'); }); diff --git a/webcomponents-lite.js b/webcomponents-lite.js index b7a8d29..270a842 100644 --- a/webcomponents-lite.js +++ b/webcomponents-lite.js @@ -21,9 +21,12 @@ var flags = {}; if (!flags.noOpts) { // from url - location.search.slice(1).split('&').forEach(function(o) { - o = o.split('='); - o[0] && (flags[o[0]] = o[1] || true); + location.search.slice(1).split('&').forEach(function(option) { + var parts = option.split('='); + var match; + if (parts[0] && (match = parts[0].match(/wc-(.+)/))) { + flags[match[1]] = parts[1] || true; + } }); // from script if (script) { diff --git a/webcomponents.js b/webcomponents.js index 8112c73..9fd4b7f 100644 --- a/webcomponents.js +++ b/webcomponents.js @@ -21,9 +21,12 @@ var flags = {}; if (!flags.noOpts) { // from url - location.search.slice(1).split('&').forEach(function(o) { - o = o.split('='); - o[0] && (flags[o[0]] = o[1] || true); + location.search.slice(1).split('&').forEach(function(option) { + var parts = option.split('='); + var match; + if (parts[0] && (match = parts[0].match(/wc-(.+)/))) { + flags[match[1]] = parts[1] || true; + } }); // from script if (script) {