aboutsummaryrefslogtreecommitdiffstats
path: root/vimiumFrontend.js
diff options
context:
space:
mode:
authorPhil Crosby2010-01-17 18:43:49 -0800
committerPhil Crosby2010-01-17 18:43:49 -0800
commit117d259bb456ef3c52efd1ef585f8e3bfa4bc097 (patch)
tree5dcb3fadd05e47f1ad7da6f6ee5b28c3c54030de /vimiumFrontend.js
parent73b742d6cca7ee6c2e5816995a0269f3d1dfc6f7 (diff)
downloadvimium-117d259bb456ef3c52efd1ef585f8e3bfa4bc097.tar.bz2
When detecting whether an element is an embed, include OBJECT as well as EMBED tags. Fixes #54.
Diffstat (limited to 'vimiumFrontend.js')
-rw-r--r--vimiumFrontend.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/vimiumFrontend.js b/vimiumFrontend.js
index a81b69c7..2d37e699 100644
--- a/vimiumFrontend.js
+++ b/vimiumFrontend.js
@@ -288,7 +288,7 @@ function onKeydown(event) {
if (insertMode && isEscape(event))
{
// Note that we can't programmatically blur out of Flash embeds from Javascript.
- if (event.srcElement.tagName != "EMBED") {
+ if (!isEmbed(event.srcElement)) {
// Remove focus so the user can't just get himself back into insert mode by typing in the same input box.
if (isEditable(event.srcElement)) { event.srcElement.blur(); }
exitInsertMode();
@@ -352,7 +352,13 @@ function onBlurCapturePhase(event) {
/*
* Returns true if the element is focusable. This includes embeds like Flash, which steal the keybaord focus.
*/
-function isFocusable(element) { return isEditable(element) || element.tagName == "EMBED"; }
+function isFocusable(element) { return isEditable(element) || isEmbed(element); }
+
+/*
+ * Embedded elements like Flash and quicktime players can obtain focus but cannot be programmatically
+ * unfocused.
+ */
+function isEmbed(element) { return ["EMBED", "OBJECT"].indexOf(element.tagName) > 0; }
/*
* Input or text elements are considered focusable and able to receieve their own keyboard events,