From 40963e7b35490de8a8629355a5b26b1e00cd4260 Mon Sep 17 00:00:00 2001 From: Jez Ng Date: Thu, 19 Jan 2012 01:27:57 +0800 Subject: When activating links, click instead of setting window.location. This allows us to activate Ajax links properly. --- vimiumFrontend.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/vimiumFrontend.js b/vimiumFrontend.js index 3521dca5..ea2c33d5 100644 --- a/vimiumFrontend.js +++ b/vimiumFrontend.js @@ -843,7 +843,11 @@ function findAndFollowLink(linkStrings) { if (hasResults) { var link = getLinkFromSelection(); if (link) { - window.location = link.href; + domUtils.simulateClick(link); + // blur the element just in case it already has focus. then when we re-focus it, the browser will + // scroll such that it is visible. + link.blur(); + link.focus(); return true; } } @@ -857,7 +861,9 @@ function findAndFollowRel(value) { var elements = document.getElementsByTagName(relTags[i]); for (j = 0; j < elements.length; j++) { if (elements[j].hasAttribute('rel') && elements[j].rel == value) { - window.location = elements[j].href; + domUtils.simulateClick(elements[j]); + link.blur(); + link.focus(); return true; } } -- cgit v1.2.3