| Index: include.preload.js |
| =================================================================== |
| --- a/include.preload.js |
| +++ b/include.preload.js |
| @@ -336,17 +336,17 @@ |
| document.removeEventListener("DOMContentLoaded", this.trace); |
| this.observer.disconnect(); |
| clearTimeout(this.timeout); |
| } |
| }; |
| function ElemHide() |
| { |
| - this.shadow = this.createShadowTree(); |
| + this.shadow = null; |
| this.styles = new Map(); |
| this.tracer = null; |
| this.inline = true; |
| this.inlineEmulated = true; |
| this.emulatedPatterns = null; |
| this.elemHideEmulation = new ElemHideEmulation( |
| this.addSelectors.bind(this), |
| @@ -390,16 +390,19 @@ |
| style.sheet.deleteRule(0); |
| } |
| if (selectors.length == 0) |
| return; |
| if (!style) |
| { |
| + if (!this.shadow) |
| + this.shadow = this.createShadowTree(); |
| + |
| // Create <style> element lazily, only if we add styles. Add it to |
| // the shadow DOM if possible. Otherwise fallback to the <head> or |
| // <html> element. If we have injected a style element before that |
| // has been removed (the sheet property is null), create a new one. |
| style = document.createElement("style"); |
| (this.shadow || document.head || |
| document.documentElement).appendChild(style); |