diff options
| author | Stephen Blott | 2018-12-16 07:49:36 +0000 | 
|---|---|---|
| committer | GitHub | 2018-12-16 07:49:36 +0000 | 
| commit | 451ef4e357f45d1a965cdda1788e87600b6a5b23 (patch) | |
| tree | 6b9d1f696be61d6e13a077756df9407d6f2fc803 /content_scripts | |
| parent | 7c77b9bef6720283b04f6253b5e3cec0c7612b15 (diff) | |
| parent | 5307f07729f2a35debbee6ef8c5f09493a8b81bf (diff) | |
| download | vimium-451ef4e357f45d1a965cdda1788e87600b6a5b23.tar.bz2 | |
Merge pull request #3175 from gdh1995/shadowDOMv1
use Shadow DOM v1 if it exists
Diffstat (limited to 'content_scripts')
| -rw-r--r-- | content_scripts/ui_component.coffee | 3 | ||||
| -rw-r--r-- | content_scripts/vimium_frontend.coffee | 5 | 
2 files changed, 6 insertions, 2 deletions
| diff --git a/content_scripts/ui_component.coffee b/content_scripts/ui_component.coffee index c71bfb35..d3145eb3 100644 --- a/content_scripts/ui_component.coffee +++ b/content_scripts/ui_component.coffee @@ -27,7 +27,8 @@ class UIComponent          seamless: "seamless"        shadowWrapper = DomUtils.createElement "div"        # PhantomJS doesn't support createShadowRoot, so guard against its non-existance. -      @shadowDOM = shadowWrapper.createShadowRoot?() ? shadowWrapper +      @shadowDOM = shadowWrapper.attachShadow?( mode: "open" ) ? +        shadowWrapper.createShadowRoot?() ? shadowWrapper        @shadowDOM.appendChild styleSheet        @shadowDOM.appendChild @iframeElement        @toggleIframeElementClasses "vimiumUIComponentVisible", "vimiumUIComponentHidden" diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index ff27c8a4..0f5d05f2 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -245,7 +245,10 @@ flashFrame = do ->        # Create a shadow DOM wrapping the frame so the page's styles don't interfere with ours.        highlightedFrameElement = DomUtils.createElement "div"        # PhantomJS doesn't support createShadowRoot, so guard against its non-existance. -      _shadowDOM = highlightedFrameElement.createShadowRoot?() ? highlightedFrameElement +      # https://hacks.mozilla.org/2018/10/firefox-63-tricks-and-treats/ says +      # Firefox 63 has enabled Shadow DOM v1 by default +      _shadowDOM = highlightedFrameElement.attachShadow?( mode: "open" ) ? +        highlightedFrameElement.createShadowRoot?() ? highlightedFrameElement        # Inject stylesheet.        _styleSheet = DomUtils.createElement "style" | 
