Skip to content
This repository was archived by the owner on Sep 20, 2019. It is now read-only.

Commit ae35338

Browse files
committed
Merge pull request #303 from webcomponents/namespace-flags
Namespace flags
2 parents 04e3d72 + b7f56e9 commit ae35338

File tree

8 files changed

+47
-29
lines changed

8 files changed

+47
-29
lines changed

src/CustomElements/CustomElements.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@ window.CustomElements = window.CustomElements || {flags:{}};
1616
// Flags. Convert url arguments to flags
1717
var flags = {};
1818
if (!flags.noOpts) {
19-
location.search.slice(1).split('&').forEach(function(o) {
20-
o = o.split('=');
21-
o[0] && (flags[o[0]] = o[1] || true);
19+
location.search.slice(1).split('&').forEach(function(option) {
20+
var parts = option.split('=');
21+
var match;
22+
if (parts[0] && (match = parts[0].match(/wc-(.+)/))) {
23+
flags[match[1]] = parts[1] || true;
24+
}
2225
});
2326
}
2427

src/HTMLImports/HTMLImports.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@ window.HTMLImports = window.HTMLImports || {flags:{}};
1616
// Flags. Convert url arguments to flags
1717
var flags = {};
1818
if (!flags.noOpts) {
19-
location.search.slice(1).split('&').forEach(function(o) {
20-
o = o.split('=');
21-
o[0] && (flags[o[0]] = o[1] || true);
19+
location.search.slice(1).split('&').forEach(function(option) {
20+
var parts = option.split('=');
21+
var match;
22+
if (parts[0] && (match = parts[0].match(/wc-(.+)/))) {
23+
flags[match[1]] = parts[1] || true;
24+
}
2225
});
2326
}
2427

src/WebComponents/build/boot-lite.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,22 @@ window.WebComponents = window.WebComponents || {};
1111

1212
// process flags
1313
(function(scope){
14-
14+
1515
// import
1616
var flags = scope.flags || {};
17-
17+
1818
var file = 'webcomponents-lite.js';
1919
var script = document.querySelector('script[src*="' + file + '"]');
2020

2121
// Flags. Convert url arguments to flags
2222
if (!flags.noOpts) {
2323
// from url
24-
location.search.slice(1).split('&').forEach(function(o) {
25-
o = o.split('=');
26-
o[0] && (flags[o[0]] = o[1] || true);
24+
location.search.slice(1).split('&').forEach(function(option) {
25+
var parts = option.split('=');
26+
var match;
27+
if (parts[0] && (match = parts[0].match(/wc-(.+)/))) {
28+
flags[match[1]] = parts[1] || true;
29+
}
2730
});
2831
// from script
2932
if (script) {
@@ -48,7 +51,7 @@ window.WebComponents = window.WebComponents || {};
4851
// Determine default settings.
4952
// If any of these flags match 'native', then force native ShadowDOM; any
5053
// other truthy value, or failure to detect native
51-
// ShadowDOM, results in polyfill
54+
// ShadowDOM, results in polyfill
5255
flags.shadow = (flags.shadow || flags.shadowdom || flags.polyfill);
5356
if (flags.shadow === 'native') {
5457
flags.shadow = false;

src/WebComponents/build/boot.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,12 @@ window.WebComponents = window.WebComponents || {};
2121
// Flags. Convert url arguments to flags
2222
if (!flags.noOpts) {
2323
// from url
24-
location.search.slice(1).split('&').forEach(function(o) {
25-
o = o.split('=');
26-
o[0] && (flags[o[0]] = o[1] || true);
24+
location.search.slice(1).split('&').forEach(function(option) {
25+
var parts = option.split('=');
26+
var match;
27+
if (parts[0] && (match = parts[0].match(/wc-(.+)/))) {
28+
flags[match[1]] = parts[1] || true;
29+
}
2730
});
2831
// from script
2932
if (script) {

tests/ShadowCSS/tests.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@
1010

1111
htmlSuite('ShadowCss', function() {
1212
htmlTest('html/pseudo-scoping.html');
13-
htmlTest('html/pseudo-scoping.html?shadow');
13+
htmlTest('html/pseudo-scoping.html?wc-shadow');
1414
htmlTest('html/pseudo-scoping-strict.html');
15-
htmlTest('html/pseudo-scoping-strict.html?shadow');
15+
htmlTest('html/pseudo-scoping-strict.html?wc-shadow');
1616
htmlTest('html/polyfill-directive.html');
1717
htmlTest('html/polyfill-rule.html');
1818
htmlTest('html/colon-host.html');
19-
htmlTest('html/colon-host.html?shadow');
20-
htmlTest('html/combinators.html?shadow');
19+
htmlTest('html/colon-host.html?wc-shadow');
20+
htmlTest('html/combinators.html?wc-shadow');
2121
htmlTest('html/combinators-shadow.html');
22-
htmlTest('html/combinators-shadow.html?shadow');
22+
htmlTest('html/combinators-shadow.html?wc-shadow');
2323
htmlTest('html/compressed.html');
2424
htmlTest('html/before-content.html');
25-
htmlTest('html/before-content.html?shadow');
25+
htmlTest('html/before-content.html?wc-shadow');
2626
htmlTest('html/before-content.html');
2727
htmlTest('html/style-import.html');
2828
htmlTest('html/style-import-base-tag.html');

tests/WebComponents/tests.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ htmlSuite('loader and build', function() {
1717
htmlSuite('integration', function() {
1818
htmlTest('html/web-components.html');
1919
htmlTest('html/smoke.html');
20-
htmlTest('html/smoke.html?shadow');
20+
htmlTest('html/smoke.html?wc-shadow');
2121
htmlTest('html/ce-import.html');
2222
htmlTest('html/ce-upgradedocumenttree.html');
23-
htmlTest('html/ce-import.html?shadow');
23+
htmlTest('html/ce-import.html?wc-shadow');
2424
htmlTest('html/ce-upgrade-order.html');
2525
});
2626

webcomponents-lite.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,12 @@
2121
var flags = {};
2222
if (!flags.noOpts) {
2323
// from url
24-
location.search.slice(1).split('&').forEach(function(o) {
25-
o = o.split('=');
26-
o[0] && (flags[o[0]] = o[1] || true);
24+
location.search.slice(1).split('&').forEach(function(option) {
25+
var parts = option.split('=');
26+
var match;
27+
if (parts[0] && (match = parts[0].match(/wc-(.+)/))) {
28+
flags[match[1]] = parts[1] || true;
29+
}
2730
});
2831
// from script
2932
if (script) {

webcomponents.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,12 @@
2121
var flags = {};
2222
if (!flags.noOpts) {
2323
// from url
24-
location.search.slice(1).split('&').forEach(function(o) {
25-
o = o.split('=');
26-
o[0] && (flags[o[0]] = o[1] || true);
24+
location.search.slice(1).split('&').forEach(function(option) {
25+
var parts = option.split('=');
26+
var match;
27+
if (parts[0] && (match = parts[0].match(/wc-(.+)/))) {
28+
flags[match[1]] = parts[1] || true;
29+
}
2730
});
2831
// from script
2932
if (script) {

0 commit comments

Comments
 (0)