From 42420a12e28d23627bee58cda756c51a5d40a599 Mon Sep 17 00:00:00 2001 From: Phil Crosby Date: Sun, 17 Jan 2010 18:53:30 -0800 Subject: Use document.activeElement instead of focusNode when detecting focus. This should be equivalent and simplify the implementation.--- vimiumFrontend.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/vimiumFrontend.js b/vimiumFrontend.js index 2d37e699..fef755e4 100644 --- a/vimiumFrontend.js +++ b/vimiumFrontend.js @@ -154,11 +154,7 @@ function initializeOnDomReady() { */ function enterInsertModeIfElementIsFocused() { // Enter insert mode automatically if there's already a text box focused. - // TODO(philc): Consider using document.activeElement here instead. - var focusNode = window.getSelection().focusNode; - var focusOffset = window.getSelection().focusOffset; - if (focusNode && focusOffset != null && focusNode.children.length > focusOffset && - isEditable(focusNode.children[focusOffset])) + if (document.activeElement && isEditable(document.activeElement)) enterInsertMode(); } -- cgit v1.2.3