MCPcopy Index your code
hub / github.com/philc/vimium / selectFoundInputElement

Function selectFoundInputElement

content_scripts/mode_find.js:433–445  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

431};
432
433const selectFoundInputElement = function () {
434 // Since the last focused element might not be the one currently pointed to by find (e.g. the
435 // current one might be disabled and therefore unable to receive focus), we use the approximate
436 // heuristic of checking that the last anchor node is an ancestor of our element.
437 const findModeAnchorNode = document.getSelection().anchorNode;
438 if (
439 FindMode.query.hasResults && document.activeElement &&
440 DomUtils.isSelectable(document.activeElement) &&
441 DomUtils.isDOMDescendant(findModeAnchorNode, document.activeElement)
442 ) {
443 return DomUtils.simulateSelect(document.activeElement);
444 }
445};
446
447// Retrieve the starting indices of all matches of the queried pattern within the given text.
448const getRegexMatchIndices = (text, regex) => {

Callers 1

handleEscapeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected