aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgdh19952015-08-29 21:42:36 +0800
committergdh19952015-08-29 21:42:36 +0800
commit0537ebb07670909a21134e16ed30b3786fc6f4a0 (patch)
treef5879d5ee0fbdfd80fd9366a20bcd2b65bd84cc7
parent684d14c9ccfbb48f040d238f1564825d11f3551a (diff)
downloadvimium-0537ebb07670909a21134e16ed30b3786fc6f4a0.tar.bz2
use documentReady instead of setTimeout to init focusThisFrame
-rw-r--r--content_scripts/vimium_frontend.coffee5
1 files changed, 3 insertions, 2 deletions
diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee
index 962b7d6d..ddc80464 100644
--- a/content_scripts/vimium_frontend.coffee
+++ b/content_scripts/vimium_frontend.coffee
@@ -274,7 +274,7 @@ setScrollPosition = ({ scrollX, scrollY }) ->
#
# Called from the backend in order to change frame focus.
#
-setTimeout (->
+DomUtils.documentReady ->
# 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.
@@ -302,7 +302,8 @@ setTimeout (->
if shouldHighlight
document.documentElement.appendChild highlightedFrameElement
setTimeout (-> highlightedFrameElement.remove()), 200
-), 0
+
+window.focusThisFrame = ->
extend window,
scrollToBottom: ->