MCPcopy Create free account
hub / github.com/ronreiter/interactive-tutorials / get

Function get

static/scripts/markitup/jquery.markitup.js:388–410  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

386
387 // get the selection
388 function get() {
389 textarea.focus();
390
391 scrollPosition = textarea.scrollTop;
392 if (document.selection) {
393 selection = document.selection.createRange().text;
394 if ($.browser.msie) { // ie
395 var range = document.selection.createRange(), rangeCopy = range.duplicate();
396 rangeCopy.moveToElementText(textarea);
397 caretPosition = -1;
398 while(rangeCopy.inRange(range)) { // fix most of the ie bugs with linefeeds...
399 rangeCopy.moveStart('character');
400 caretPosition ++;
401 }
402 } else { // opera
403 caretPosition = textarea.selectionStart;
404 }
405 } else { // gecko
406 caretPosition = textarea.selectionStart;
407 selection = $$.val().substring(caretPosition, textarea.selectionEnd);
408 }
409 return selection;
410 }
411
412 // open preview window
413 function preview() {

Callers 3

initFunction · 0.70
markupFunction · 0.70
keyPressedFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected