Skip to content
This repository was archived by the owner on Mar 13, 2018. It is now read-only.

Commit e2f35a7

Browse files
committed
Allow users to opt in to native ShadowDOM even when a fully supported version is not available via ?shadow=native.
1 parent e53d666 commit e2f35a7

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

platform.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,20 @@ function processFlags(flags) {
1616
} else {
1717
// truthy value for any of these flags, or failure to detect native
1818
// ShadowDOM, results in polyfill
19-
flags.shadow = (flags.shadowdom || flags.shadow || flags.polyfill ||
20-
!HTMLElement.prototype.createShadowRoot) && 'polyfill';
19+
//flags.shadow = (flags.shadowdom || flags.shadow || flags.polyfill ||
20+
// !HTMLElement.prototype.createShadowRoot) && 'polyfill';
21+
22+
// If any of these flags match 'native', then force native ShadowDOM; any
23+
// other truthy value, or failure to detect native
24+
// ShadowDOM, results in polyfill
25+
flags.shadow = (flags.shadow || flags.shadowdom || flags.polyfill);
26+
if (flags.shadow === 'native') {
27+
flags.shadow = false;
28+
} else {
29+
flags.shadow = flags.shadow || !HTMLElement.prototype.createShadowRoot
30+
&& 'polyfill';
31+
}
32+
2133

2234
var ShadowDOMNative = [
2335
'src/patches-shadowdom-native.js'

0 commit comments

Comments
 (0)