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

Function set

static/scripts/markitup/jquery.markitup.js:369–385  ·  view source on GitHub ↗
(start, len)

Source from the content-addressed store, hash-verified

367
368 // set a selection
369 function set(start, len) {
370 if (textarea.createTextRange){
371 // quick fix to make it work on Opera 9.5
372 if ($.browser.opera && $.browser.version >= 9.5 && len == 0) {
373 return false;
374 }
375 range = textarea.createTextRange();
376 range.collapse(true);
377 range.moveStart('character', start);
378 range.moveEnd('character', len);
379 range.select();
380 } else if (textarea.setSelectionRange ){
381 textarea.setSelectionRange(start, start + len);
382 }
383 textarea.scrollTop = scrollPosition;
384 textarea.focus();
385 }
386
387 // get the selection
388 function get() {

Callers 2

markupFunction · 0.70
keyPressedFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected