From cca64166440d0aed4c52a55e0e959d6f9afcc370 Mon Sep 17 00:00:00 2001 From: Jez Ng Date: Wed, 29 Feb 2012 17:57:45 -0500 Subject: Activate elements by setting window.location. --- vimiumFrontend.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'vimiumFrontend.js') diff --git a/vimiumFrontend.js b/vimiumFrontend.js index d65a5a23..357d444e 100644 --- a/vimiumFrontend.js +++ b/vimiumFrontend.js @@ -853,10 +853,16 @@ function getLinkFromSelection() { } // used by the findAndFollow* functions. -function followLink(link) { - link.scrollIntoView(); - link.focus(); - domUtils.simulateClick(link); +function followLink(linkElement) { + if (linkElement.nodeName.toLowerCase() === 'link') + window.location.href = linkElement.href; + else { + // if we can click on it, don't simply set location.href: some pages listen for click events to fire off + // AJAX calls. + linkElement.scrollIntoView(); + linkElement.focus(); + domUtils.simulateClick(linkElement); + } } /** -- cgit v1.2.3