js: Don't leak to global ns in position_caret.js
This commit is contained in:
parent
c8a92a0851
commit
b82823d76a
@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Copyright 2015 Artur Shaik <ashaihullin@gmail.com>
|
||||
* Copyright 2015 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
|
||||
* Copyright 2015-2016 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
|
||||
*
|
||||
* This file is part of qutebrowser.
|
||||
*
|
||||
@ -32,6 +32,7 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
(function() {
|
||||
function isElementInViewport(node) { // eslint-disable-line complexity
|
||||
var i;
|
||||
var boundingRect = (node.getClientRects()[0] ||
|
||||
@ -82,7 +83,7 @@ function isElementInViewport(node) { // eslint-disable-line complexity
|
||||
return boundingRect.top >= -20;
|
||||
}
|
||||
|
||||
(function() {
|
||||
function positionCaret() {
|
||||
var walker = document.createTreeWalker(document.body, 4, null);
|
||||
var node;
|
||||
var textNodes = [];
|
||||
@ -107,4 +108,7 @@ function isElementInViewport(node) { // eslint-disable-line complexity
|
||||
sel.removeAllRanges();
|
||||
sel.addRange(range);
|
||||
}
|
||||
}
|
||||
|
||||
positionCaret();
|
||||
})();
|
||||
|
Loading…
Reference in New Issue
Block a user