Merge pull request #303 from webcomponents/namespace-flags

Namespace flags
This commit is contained in:
AJ Ortega
2015-05-13 12:37:32 -07:00
8 changed files with 47 additions and 29 deletions

View File

@@ -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;
}
});
}

View File

@@ -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;
}
});
}

View File

@@ -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;

View File

@@ -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) {

View File

@@ -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');

View File

@@ -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');
});

View File

@@ -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) {

View File

@@ -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) {