diff options
| author | Jez Ng | 2012-01-10 01:38:54 +0800 |
|---|---|---|
| committer | Jez Ng | 2012-01-12 02:12:56 +0800 |
| commit | 83cd31cf36b469a0cee29ed13d90279a5b76f0a5 (patch) | |
| tree | 17298cb1d62a7271e7597295422546b6feafaf6a | |
| parent | f9badc3e33045f478e9433916f0f608f85a4036e (diff) | |
| download | vimium-83cd31cf36b469a0cee29ed13d90279a5b76f0a5.tar.bz2 | |
Fix regression -- issue #286 is reactivated by 34bc211.
| -rw-r--r-- | linkHints.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/linkHints.js b/linkHints.js index 170dacb8..9ee56781 100644 --- a/linkHints.js +++ b/linkHints.js @@ -151,8 +151,9 @@ var linkHints = { getVisibleClientRect: function(element) { // Note: this call will be expensive if we modify the DOM in between calls. var clientRects = element.getClientRects(); + var clientRectsLength = clientRects.length; - for (var i = 0, len = clientRects.length; i < len; i++) { + for (var i = 0; i < clientRectsLength; i++) { // Exclude links which have just a few pixels on screen, because the link hints won't show for them // anyway. if (clientRects[i].top < 0 || clientRects[i].top >= window.innerHeight - 4 || @@ -168,6 +169,10 @@ var linkHints = { computedStyle.getPropertyValue('display') == 'none') continue; + return clientRects[i]; + } + + for (var i = 0; i < clientRectsLength; i++) { // If the link has zero dimensions, it may be wrapping visible // but floated elements. Check for this. if (clientRects[i].width == 0 || clientRects[i].height == 0) { @@ -182,8 +187,6 @@ var linkHints = { return childClientRect; } } - - return clientRects[i]; }; return null; }, |
