From b8ba98602eb01975850f0bf26c9efff0ca82e976 Mon Sep 17 00:00:00 2001 From: keis Date: Sat, 14 May 2011 18:36:24 +0200 Subject: use instanceof to check element type --- examples/data/scripts/follow.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'examples') diff --git a/examples/data/scripts/follow.js b/examples/data/scripts/follow.js index ced13aa..aa4ed72 100644 --- a/examples/data/scripts/follow.js +++ b/examples/data/scripts/follow.js @@ -135,9 +135,8 @@ uzbl.follow.generateHint = function(doc, el, label, top, left) { // but at least set the href of the link. (needs some improvements) uzbl.follow.clickElem = function(item) { if(!item) return; - var name = item.tagName; - if (name == 'INPUT') { + if (item instanceof HTMLInputElement) { var type = item.type; if (type == 'text' || type == 'file' || type == 'password') { item.focus(); @@ -145,7 +144,7 @@ uzbl.follow.clickElem = function(item) { return "XXXEMIT_FORM_ACTIVEXXX"; } // otherwise fall through to a simulated mouseclick. - } else if (name == 'TEXTAREA' || name == 'SELECT') { + } else if (item instanceof HTMLTextAreaElement || item instanceof HTMLSelectElement) { item.focus(); item.select(); return "XXXEMIT_FORM_ACTIVEXXX"; -- cgit v1.2.3