diff options
| author | Jez Ng | 2012-01-25 23:55:40 -0500 |
|---|---|---|
| committer | Jez Ng | 2012-01-26 02:47:56 -0500 |
| commit | 42bb33d427e3d8c36c31753bd0c0a81bf330e4ce (patch) | |
| tree | dc06ef0827cbce8ffab16ad39aa3447f8bb99d06 /vimiumFrontend.js | |
| parent | c9db525f07b4ac1ff1293e39d2944e01ebf3651e (diff) | |
| download | vimium-42bb33d427e3d8c36c31753bd0c0a81bf330e4ce.tar.bz2 | |
Factor out common DOM functions.
Diffstat (limited to 'vimiumFrontend.js')
| -rw-r--r-- | vimiumFrontend.js | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/vimiumFrontend.js b/vimiumFrontend.js index d0daa448..84a03674 100644 --- a/vimiumFrontend.js +++ b/vimiumFrontend.js @@ -34,7 +34,7 @@ var textInputXPath = (function() { var inputElements = ["input[" + textInputTypes.map(function (type) { return '@type="' + type + '"'; }).join(" or ") + "or not(@type)]", "textarea", "*[@contenteditable='' or translate(@contenteditable, 'TRUE', 'true')='true']"]; - return utils.makeXPath(inputElements); + return domUtils.makeXPath(inputElements); })(); /** @@ -254,7 +254,7 @@ function scrollActivatedElementBy(x, y) { return; } - if (!activatedElement || utils.getVisibleClientRect(activatedElement) === null) + if (!activatedElement || domUtils.getVisibleClientRect(activatedElement) === null) activatedElement = document.body; // Chrome does not report scrollHeight accurately for nodes with pseudo-elements of height 0 (bug 110149). @@ -304,7 +304,7 @@ function scrollLeft() { scrollActivatedElementBy(-1 * settings.get("scrollStepSi function scrollRight() { scrollActivatedElementBy(settings.get("scrollStepSize"), 0); } function focusInput(count) { - var results = utils.evaluateXPath(textInputXPath, XPathResult.ORDERED_NODE_ITERATOR_TYPE); + var results = domUtils.evaluateXPath(textInputXPath, XPathResult.ORDERED_NODE_ITERATOR_TYPE); var lastInputBox; var i = 0; @@ -313,7 +313,7 @@ function focusInput(count) { var currentInputBox = results.iterateNext(); if (!currentInputBox) { break; } - if (utils.getVisibleClientRect(currentInputBox) === null) + if (domUtils.getVisibleClientRect(currentInputBox) === null) continue; lastInputBox = currentInputBox; @@ -766,9 +766,9 @@ function selectFoundInputElement() { // instead. however, since the last focused element might not be the one currently pointed to by find (e.g. // the current one might be disabled and therefore unable to receive focus), we use the approximate // heuristic of checking that the last anchor node is an ancestor of our element. - if (findModeQueryHasResults && linkHints.isSelectable(document.activeElement) && + if (findModeQueryHasResults && domUtils.isSelectable(document.activeElement) && isDOMDescendant(findModeAnchorNode, document.activeElement)) { - linkHints.simulateSelect(document.activeElement); + domUtils.simulateSelect(document.activeElement); // the element has already received focus via find(), so invoke insert mode manually enterInsertModeWithoutShowingIndicator(document.activeElement); } @@ -812,7 +812,7 @@ function findAndFocus(backwards) { keydown: function(event) { handlerStack.pop(); if (isEscape(event)) { - linkHints.simulateSelect(document.activeElement); + domUtils.simulateSelect(document.activeElement); enterInsertModeWithoutShowingIndicator(document.activeElement); return false; // we have 'consumed' this event, so do not propagate } |
