javascript Programming Glossary: sel.type
Calculate width & height of the selected text (javascript) http://stackoverflow.com/questions/12603397/calculate-width-height-of-the-selected-text-javascript var sel document.selection range var x 0 y 0 if sel if sel.type Control range sel.createRange range.collapse true x range.boundingLeft.. document.selection range var width 0 height 0 if sel if sel.type Control range sel.createRange width range.boundingWidth height..
jquery: select text event http://stackoverflow.com/questions/4367353/jquery-select-text-event mouseOrKeyUpHandler function var sel document.selection if sel.type Text var textRange sel.createRange if textRange.text selectCallback..
Get a range's start and end offset's relative to its parent container http://stackoverflow.com/questions/4811822/get-a-ranges-start-and-end-offsets-relative-to-its-parent-container preCaretRange.toString .length else if sel doc.selection sel.type Control var textRange sel.createRange var preCaretTextRange..
Inserting text into an editable IFRAME at the caret position (IE) http://stackoverflow.com/questions/5337752/inserting-text-into-an-editable-iframe-at-the-caret-position-ie var sel iframe.contentWindow.document.selection if sel.type None selectedRange sel.createRange iframe.contentWindow.attachEvent..
Editing Iframe Content in IE - problem in maintaining text selection http://stackoverflow.com/questions/5767037/editing-iframe-content-in-ie-problem-in-maintaining-text-selection function win var sel win.document.selection return sel.type None sel.createRange null restoreSelection function win savedSelection..
How to get caret position within contenteditable div with html child elements? http://stackoverflow.com/questions/5951886/how-to-get-caret-position-within-contenteditable-div-with-html-child-elements 8 saveSelection function var sel document.selection return sel.type None sel.createRange null restoreSelection function savedSelection..
Insert html at caret in a contenteditable div http://stackoverflow.com/questions/6690752/insert-html-at-caret-in-a-contenteditable-div sel.addRange range else if sel document.selection sel.type Control IE 9 var originalRange sel.createRange originalRange.collapse..
Javascript Text Selection Page Coordinates http://stackoverflow.com/questions/6846230/javascript-text-selection-page-coordinates var sel document.selection range var x 0 y 0 if sel if sel.type Control range sel.createRange range.collapse true x range.boundingLeft..
Get parent element of a selected text http://stackoverflow.com/questions/7215479/get-parent-element-of-a-selected-text parentEl.parentNode else if sel document.selection sel.type Control parentEl sel.createRange .parentElement return parentEl..
Select whole word with getSelection http://stackoverflow.com/questions/7380190/select-whole-word-with-getselection extend direction 0 word else if sel document.selection sel.type Control var textRange sel.createRange if textRange.text textRange.expand..
determine the frame id/name when a user has selected text in that frame- the page has multiple frames http://stackoverflow.com/questions/7807510/determine-the-frame-id-name-when-a-user-has-selected-text-in-that-frame-the-pag win.getSelection else if sel win.document.selection if sel.type Text return sel.createRange .text return function getIframeWithSelection..
How to know if selected text is inside a specific div http://stackoverflow.com/questions/8339857/how-to-know-if-selected-text-is-inside-a-specific-div false return true else if sel document.selection sel.type Control return isOrContains sel.createRange .parentElement el..
designMode iFrame Get Cursor Position http://stackoverflow.com/questions/8664504/designmode-iframe-get-cursor-position preCaretRange.toString .length else if sel doc.selection sel.type Control range doc.selection.createRange preCaretRange doc.body.createTextRange..
WYSIWYG editor for IE [closed] http://stackoverflow.com/questions/8739711/wysiwyg-editor-for-ie window.getSelection else if sel document.selection sel.type Text selectedText sel.createRange .text return selectedText.. foo.png ' getSelectedText span if sel document.selection sel.type Control sel.createRange .pasteHTML html else document.execCommand..
|