¡@

Home 

2014/10/16 ¤W¤È 12:02:27

jquery Programming Glossary: charindex

Persisting the changes of range objects after selection in HTML

http://stackoverflow.com/questions/13949059/persisting-the-changes-of-range-objects-after-selection-in-html

restoreSelection function containerEl savedSel var charIndex 0 range document.createRange range.setStart containerEl 0 range.collapse.. node nodeStack.pop if node.nodeType 3 var nextCharIndex charIndex node.length if foundStart savedSel.start charIndex savedSel.start.. charIndex node.length if foundStart savedSel.start charIndex savedSel.start nextCharIndex range.setStart node savedSel.start..

Javascript Contenteditable - set Cursor / Caret to index

http://stackoverflow.com/questions/16095155/javascript-contenteditable-set-cursor-caret-to-index

function containerEl start end var charIndex 0 range document.createRange range.setStart containerEl 0 range.collapse.. node nodeStack.pop if node.nodeType 3 var nextCharIndex charIndex node.length if foundStart start charIndex start nextCharIndex.. nextCharIndex charIndex node.length if foundStart start charIndex start nextCharIndex range.setStart node start charIndex foundStart..

Persisting the changes of range objects after selection in HTML

http://stackoverflow.com/questions/13949059/persisting-the-changes-of-range-objects-after-selection-in-html

.length return start start end start range.toString .length restoreSelection function containerEl savedSel var charIndex 0 range document.createRange range.setStart containerEl 0 range.collapse true var nodeStack containerEl node foundStart.. containerEl node foundStart false stop false while stop node nodeStack.pop if node.nodeType 3 var nextCharIndex charIndex node.length if foundStart savedSel.start charIndex savedSel.start nextCharIndex range.setStart node savedSel.start charIndex.. stop node nodeStack.pop if node.nodeType 3 var nextCharIndex charIndex node.length if foundStart savedSel.start charIndex savedSel.start nextCharIndex range.setStart node savedSel.start charIndex foundStart true if foundStart savedSel.end..

Javascript Contenteditable - set Cursor / Caret to index

http://stackoverflow.com/questions/16095155/javascript-contenteditable-set-cursor-caret-to-index

null if window.getSelection document.createRange setSelectionByCharacterOffsets function containerEl start end var charIndex 0 range document.createRange range.setStart containerEl 0 range.collapse true var nodeStack containerEl node foundStart.. containerEl node foundStart false stop false while stop node nodeStack.pop if node.nodeType 3 var nextCharIndex charIndex node.length if foundStart start charIndex start nextCharIndex range.setStart node start charIndex foundStart true if.. false while stop node nodeStack.pop if node.nodeType 3 var nextCharIndex charIndex node.length if foundStart start charIndex start nextCharIndex range.setStart node start charIndex foundStart true if foundStart end charIndex end nextCharIndex..