From d1e88c5e8db02ee3a66d0d4b51cc231a0a04c8e7 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 12 May 2015 07:11:45 +0200 Subject: [PATCH] js: Add 'var'. --- qutebrowser/javascript/position_caret.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/qutebrowser/javascript/position_caret.js b/qutebrowser/javascript/position_caret.js index 62e610245..d3cdbf43a 100644 --- a/qutebrowser/javascript/position_caret.js +++ b/qutebrowser/javascript/position_caret.js @@ -54,7 +54,8 @@ function isElementInViewport(node) { if (boundingRect.width <= 1 || boundingRect.height <= 1) { var children = node.children; var visibleChildNode = false; - for (i = 0, l = children.length; i < l; ++i) { + var l = children.length; + for (i = 0; i < l; ++i) { boundingRect = (children[i].getClientRects()[0] || children[i].getBoundingClientRect()); if (boundingRect.width > 1 && boundingRect.height > 1) { @@ -85,6 +86,7 @@ function isElementInViewport(node) { var walker = document.createTreeWalker(document.body, 4, null); var node; var textNodes = []; + var el; while (node = walker.nextNode()) { if (node.nodeType === 3 && node.data.trim() !== '') { textNodes.push(node);