aboutsummaryrefslogtreecommitdiffstats
path: root/content_scripts/vimium_frontend.coffee
diff options
context:
space:
mode:
authormrmr19932015-08-26 18:21:27 +0100
committermrmr19932015-08-26 18:22:52 +0100
commit46fe5cffc952b80371f839fce0aa2fc8ded27f50 (patch)
tree95d1a8e17e2925476d5206ac85cf161d6c5f436b /content_scripts/vimium_frontend.coffee
parentc08e59ea14c5b691a20a62d204456a8496258d0f (diff)
downloadvimium-46fe5cffc952b80371f839fce0aa2fc8ded27f50.tar.bz2
Use createElementNS for XML documents and remove XML specific codepaths
This implements @gdh1995's idea from #1796.
Diffstat (limited to 'content_scripts/vimium_frontend.coffee')
-rw-r--r--content_scripts/vimium_frontend.coffee17
1 files changed, 8 insertions, 9 deletions
diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee
index 9d850419..62aa684d 100644
--- a/content_scripts/vimium_frontend.coffee
+++ b/content_scripts/vimium_frontend.coffee
@@ -276,17 +276,16 @@ setScrollPosition = ({ scrollX, scrollY }) ->
#
window.focusThisFrame = do ->
# Create a shadow DOM wrapping the frame so the page's styles don't interfere with ours.
- highlightedFrameElement = document.createElement "div"
+ highlightedFrameElement = DomUtils.createElement "div"
# PhantomJS doesn't support createShadowRoot, so guard against its non-existance.
_shadowDOM = highlightedFrameElement.createShadowRoot?() ? highlightedFrameElement
# Inject stylesheet.
- _styleSheet = document.createElement "style"
- if _styleSheet.style?
- _styleSheet.innerHTML = "@import url(\"#{chrome.runtime.getURL("content_scripts/vimium.css")}\");"
- _shadowDOM.appendChild _styleSheet
+ _styleSheet = DomUtils.createElement "style"
+ _styleSheet.innerHTML = "@import url(\"#{chrome.runtime.getURL("content_scripts/vimium.css")}\");"
+ _shadowDOM.appendChild _styleSheet
- _frameEl = document.createElement "div"
+ _frameEl = DomUtils.createElement "div"
_frameEl.className = "vimiumReset vimiumHighlightedFrame"
_shadowDOM.appendChild _frameEl
@@ -405,7 +404,7 @@ extend window,
Math.min(count, visibleInputs.length) - 1
hints = for tuple in visibleInputs
- hint = document.createElement "div"
+ hint = DomUtils.createElement "div"
hint.className = "vimiumReset internalVimiumInputHint vimiumInputHint"
# minus 1 for the border
@@ -775,7 +774,7 @@ window.enterFindMode = ->
window.showHelpDialog = (html, fid) ->
return if (isShowingHelpDialog || !document.body || fid != frameId)
isShowingHelpDialog = true
- container = document.createElement("div")
+ container = DomUtils.createElement("div")
container.id = "vimiumHelpDialogContainer"
container.className = "vimiumReset"
@@ -861,7 +860,7 @@ CursorHider =
# See #1345 and #1348.
return unless Utils.haveChromeVersion "39.0.2171.71"
- @cursorHideStyle = document.createElement("style")
+ @cursorHideStyle = DomUtils.createElement("style")
@cursorHideStyle.innerHTML = """
body * {pointer-events: none !important; cursor: none !important;}
body, html {cursor: none !important;}