From e2f35a74ff62d18f90f28ad9c6ba4858d94d4c94 Mon Sep 17 00:00:00 2001 From: Steve Orvell Date: Fri, 16 Aug 2013 10:56:25 -0700 Subject: [PATCH] Allow users to opt in to native ShadowDOM even when a fully supported version is not available via ?shadow=native. --- platform.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/platform.js b/platform.js index a440ee1..d35a1ec 100644 --- a/platform.js +++ b/platform.js @@ -16,8 +16,20 @@ function processFlags(flags) { } else { // truthy value for any of these flags, or failure to detect native // ShadowDOM, results in polyfill - flags.shadow = (flags.shadowdom || flags.shadow || flags.polyfill || - !HTMLElement.prototype.createShadowRoot) && 'polyfill'; + //flags.shadow = (flags.shadowdom || flags.shadow || flags.polyfill || + // !HTMLElement.prototype.createShadowRoot) && 'polyfill'; + + // 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 + && 'polyfill'; + } + var ShadowDOMNative = [ 'src/patches-shadowdom-native.js'