MCPcopy Index your code
hub / github.com/DHTMLX/gantt / restoreSelection

Function restoreSelection

samples/common/codehighlight/codemirror.js:4057–4069  ·  view source on GitHub ↗
(snapshot)

Source from the content-addressed store, hash-verified

4055 }
4056
4057 function restoreSelection(snapshot) {
4058 if (!snapshot || !snapshot.activeElt || snapshot.activeElt == activeElt()) { return }
4059 snapshot.activeElt.focus();
4060 if (!/^(INPUT|TEXTAREA)$/.test(snapshot.activeElt.nodeName) &&
4061 snapshot.anchorNode && contains(document.body, snapshot.anchorNode) && contains(document.body, snapshot.focusNode)) {
4062 var sel = window.getSelection(), range = document.createRange();
4063 range.setEnd(snapshot.anchorNode, snapshot.anchorOffset);
4064 range.collapse(false);
4065 sel.removeAllRanges();
4066 sel.addRange(range);
4067 sel.extend(snapshot.focusNode, snapshot.focusOffset);
4068 }
4069 }
4070
4071 // Does the actual updating of the line display. Bails out
4072 // (returning false) when there is nothing to be done and forced is

Callers 1

updateDisplayIfNeededFunction · 0.85

Calls 5

activeEltFunction · 0.85
containsFunction · 0.85
setEndMethod · 0.80
focusMethod · 0.65
collapseMethod · 0.65

Tested by

no test coverage detected