diff options
| author | Phil Crosby | 2010-09-05 15:46:02 -0700 |
|---|---|---|
| committer | Phil Crosby | 2010-09-05 15:46:40 -0700 |
| commit | 29688d9880fcceb3033a7a2a1bdc0eea5eadfd55 (patch) | |
| tree | c6943f00cb9a703e4511b488ecc164f94b6936e7 /vimiumFrontend.js | |
| parent | ce2093fcfef6f7000edc7eae026c7d529273199d (diff) | |
| download | vimium-29688d9880fcceb3033a7a2a1bdc0eea5eadfd55.tar.bz2 | |
Make it so that 'gotoFirstInput' does not require the text box to have an ID on it.
Diffstat (limited to 'vimiumFrontend.js')
| -rw-r--r-- | vimiumFrontend.js | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/vimiumFrontend.js b/vimiumFrontend.js index f2f5abd3..d74c6d53 100644 --- a/vimiumFrontend.js +++ b/vimiumFrontend.js @@ -200,15 +200,11 @@ function scrollRight() { window.scrollBy(settings["scrollStepSize"], 0); } function focusFirstInput() { var xpath = '//input[@type="text" or @type="search"]'; - var result = document.evaluate( xpath, document.documentElement, null, - XPathResult.FIRST_ORDERED_NODE_TYPE, null ); - - if ( result.singleNodeValue == null ) return; - - var el = document.getElementById( result.singleNodeValue.id ); - if ( el ) { - el.focus(); - } + var result = document.evaluate(xpath, document.documentElement, null, + XPathResult.FIRST_ORDERED_NODE_TYPE, null); + if (!result.singleNodeValue) + return; + result.singleNodeValue.focus(); } function reload() { window.location.reload(); } |
