javascript Programming Glossary: node.nodetype
How to move cursor to end of contenteditable entity http://stackoverflow.com/questions/1125292/how-to-move-cursor-to-end-of-contenteditable-entity element can contain text function canContainText node if node.nodeType 1 is an element node return voidNodeTags.contains node.nodeName..
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 false stop false while stop node nodeStack.pop if node.nodeType 3 var nextCharIndex charIndex node.length if foundStart savedSel.start..
How to replace text in html document without affecting the markup? http://stackoverflow.com/questions/1512876/how-to-replace-text-in-html-document-without-affecting-the-markup node var childs node.childNodes i 0 while node childs i if node.nodeType 3 text node found do the replacement if node.textContent node.textContent..
Remove whitespace and line breaks between HTML elements using jQuery http://stackoverflow.com/questions/1539367/remove-whitespace-and-line-breaks-between-html-elements-using-jquery i var node element.childNodes i if node.nodeType 3 S .test node.nodeValue Element.remove node share improve..
Javascript Contenteditable - set Cursor / Caret to index http://stackoverflow.com/questions/16095155/javascript-contenteditable-set-cursor-caret-to-index false stop false while stop node nodeStack.pop if node.nodeType 3 var nextCharIndex charIndex node.length if foundStart start..
IE support for DOM importNode http://stackoverflow.com/questions/1811116/ie-support-for-dom-importnode 12 document._importNode function node allChildren switch node.nodeType case document.ELEMENT_NODE var newNode document.createElement..
How to delete an HTML element inside a div with attribute contentEditable? http://stackoverflow.com/questions/2177958/how-to-delete-an-html-element-inside-a-div-with-attribute-contenteditable big browsers function getLastTextNodeIn node while node if node.nodeType 3 return node else node node.lastChild function isRangeAfterNode.. nodeRange 1 else if range.compareEndPoints if node.nodeType 1 nodeRange document.body.createTextRange nodeRange.moveToElementText..
How to find cursor position in a contenteditable DIV? http://stackoverflow.com/questions/2213376/how-to-find-cursor-position-in-a-contenteditable-div range document.selection.createRange html node.nodeType 3 node.data node.outerHTML range.pasteHTML html If you would..
Prevent selection in HTML http://stackoverflow.com/questions/2326004/prevent-selection-in-html an element's descendants function makeUnselectable node if node.nodeType 1 node.setAttribute unselectable on var child node.firstChild..
getElementsByTagName() equivalent for textNodes http://stackoverflow.com/questions/2579666/getelementsbytagname-equivalent-for-textnodes var node root.childNodes 0 while node null if node.nodeType 3 Fixed a bug here. Thanks @theazureshadow result.push node.nodeValue..
innerText/textContent vs. retrieving each text node [duplicate] http://stackoverflow.com/questions/2653670/innertext-textcontent-vs-retrieving-each-text-node following function in the past function getText node if node.nodeType 3 return node.data var txt '' if node node.firstChild do txt..
How do I select text nodes with jQuery? http://stackoverflow.com/questions/298750/how-do-i-select-text-nodes-with-jquery nonWhitespaceMatcher S function getTextNodes node if node.nodeType 3 if includeWhitespaceNodes nonWhitespaceMatcher.test node.nodeValue..
Making things unselectable in IE http://stackoverflow.com/questions/4448671/making-things-unselectable-in-ie an element's descendants function makeUnselectable node if node.nodeType 1 node.setAttribute unselectable on var child node.firstChild..
Set caret position right after the inserted element in a contentEditable div http://stackoverflow.com/questions/4834793/set-caret-position-right-after-the-inserted-element-in-a-contenteditable-div undefined document.selection.type Control var html node.nodeType 1 node.outerHTML node.data var id marker_ Math.random .slice..
replace innerHTML in contenteditable div http://stackoverflow.com/questions/5595956/replace-innerhtml-in-contenteditable-div range function traverseTextNodes node range if node.nodeType 3 if foundStart node range.startContainer start charIndex.. containerEl 0 function traverseTextNodes node if node.nodeType 3 var nextCharIndex charIndex node.length if foundStart savedSel.start..
Javascript Regex to replace text NOT in html attributes [duplicate] http://stackoverflow.com/questions/5904914/javascript-regex-to-replace-text-not-in-html-attributes walker function function walk node var child next switch node.nodeType case 1 Element case 9 Document case 11 Document fragment child..
Highlight text range using JavaScript http://stackoverflow.com/questions/6240139/highlight-text-range-using-javascript setting code function getTextNodesIn node var textNodes if node.nodeType 3 textNodes.push node else var children node.childNodes for..
Is there a way to make text unselectable on an html page? [duplicate] http://stackoverflow.com/questions/69430/is-there-a-way-to-make-text-unselectable-on-an-html-page an element's descendants function makeUnselectable node if node.nodeType 1 node.setAttribute unselectable on var child node.firstChild..
|