aboutsummaryrefslogtreecommitdiffstats
path: root/vimiumFrontend.js
diff options
context:
space:
mode:
authorPhil Crosby2010-01-17 18:53:30 -0800
committerPhil Crosby2010-01-17 18:53:43 -0800
commit42420a12e28d23627bee58cda756c51a5d40a599 (patch)
treee49c81c0e596214f5aa496a21d8f4c947b802c79 /vimiumFrontend.js
parent117d259bb456ef3c52efd1ef585f8e3bfa4bc097 (diff)
downloadvimium-42420a12e28d23627bee58cda756c51a5d40a599.tar.bz2
Use document.activeElement instead of focusNode when detecting focus.
This should be equivalent and simplify the implementation.
Diffstat (limited to 'vimiumFrontend.js')
-rw-r--r--vimiumFrontend.js6
1 files changed, 1 insertions, 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();
}