jquery Programming Glossary: node.nodetype
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..
Loop through text nodes inside a div http://stackoverflow.com/questions/2525368/loop-through-text-nodes-inside-a-div node childs i i text node found do the replacement if node.nodeType 3 grab value of current text node var value content node grab.. function ReplaceChildText node findText replaceText if node.nodeType 3 node.innerHTML node.innerHTML.replace findText replaceText..
Contenteditable text editor and cursor position http://stackoverflow.com/questions/2937975/contenteditable-text-editor-and-cursor-position range document.selection.createRange html node.nodeType 3 node.data node.outerHTML range.pasteHTML html If you would..
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..
jQuery what is faster: selectors or methods? http://stackoverflow.com/questions/4262928/jquery-what-is-faster-selectors-or-methods type ... case first while node node.previousSibling if node.nodeType 1 return false if type first return true node elem .....
Use javascript to count immediate child elements of an element http://stackoverflow.com/questions/5685184/use-javascript-to-count-immediate-child-elements-of-an-element var i 0 i w.childNodes.length i var node w.childNodes i if node.nodeType Node.ELEMENT_NODE node.nodeName SECTION count share improve..
How to get xpath with jquery in click http://stackoverflow.com/questions/8450130/how-to-get-xpath-with-jquery-in-click null sibling sibling.previousSibling while sibling if node.nodeType 1 path.push node.nodeName.toLowerCase node.id @id ' node.id..
Get xpath location of element in iframe(iframe from my domain) http://stackoverflow.com/questions/8524621/get-xpath-location-of-element-in-iframeiframe-from-my-domain null sibling sibling.previousSibling while sibling if node.nodeType 1 path.push node.nodeName.toLowerCase node.id @id ' node.id..
get text of an element without children in javascript http://stackoverflow.com/questions/9955955/get-text-of-an-element-without-children-in-javascript text.split .length 1 text.split .reverse .join edit using node.nodeType doesn't really help and here's why Imaginge the following HTML..
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 0 range.collapse true var nodeStack 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..
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 oldText newText node node node document.body base 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 node.textContent.replace oldText newText else..
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
Javascript Contenteditable - set Cursor / Caret to index http://stackoverflow.com/questions/16095155/javascript-contenteditable-set-cursor-caret-to-index 0 range.collapse true var nodeStack 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..
Loop through text nodes inside a div http://stackoverflow.com/questions/2525368/loop-through-text-nodes-inside-a-div childs.length loop through each text node for var i 0 node node childs i i text node found do the replacement if node.nodeType 3 grab value of current text node var value content node grab class name of current text node var myclass this .attr class.. but in plain javascript you can just write a recursive function function ReplaceChildText node findText replaceText if node.nodeType 3 node.innerHTML node.innerHTML.replace findText replaceText else for var child in node.childNodes ReplaceChildText child..
Contenteditable text editor and cursor position http://stackoverflow.com/questions/2937975/contenteditable-text-editor-and-cursor-position .insertNode node else if document.selection document.selection.createRange range document.selection.createRange html node.nodeType 3 node.data node.outerHTML range.pasteHTML html If you would rather insert an HTML string function insertHtmlAtCursor html..
How do I select text nodes with jQuery? http://stackoverflow.com/questions/298750/how-do-i-select-text-nodes-with-jquery function getTextNodesIn node includeWhitespaceNodes var textNodes nonWhitespaceMatcher S function getTextNodes node if node.nodeType 3 if includeWhitespaceNodes nonWhitespaceMatcher.test node.nodeValue textNodes.push node else for var i 0 len node.childNodes.length..
jQuery what is faster: selectors or methods? http://stackoverflow.com/questions/4262928/jquery-what-is-faster-selectors-or-methods CHILD function elem match var type match 1 node elem switch type ... case first while node node.previousSibling if node.nodeType 1 return false if type first return true node elem ... In second case jQuery slices the collection but I am not sure..
Use javascript to count immediate child elements of an element http://stackoverflow.com/questions/5685184/use-javascript-to-count-immediate-child-elements-of-an-element
How to get xpath with jquery in click http://stackoverflow.com/questions/8450130/how-to-get-xpath-with-jquery-in-click node.nodeName var count 1 sibling null else var count null sibling sibling.previousSibling while sibling if node.nodeType 1 path.push node.nodeName.toLowerCase node.id @id ' node.id ' count 0 count '' return path or with this code function..
Get xpath location of element in iframe(iframe from my domain) http://stackoverflow.com/questions/8524621/get-xpath-location-of-element-in-iframeiframe-from-my-domain node.nodeName var count 1 sibling null else var count null sibling sibling.previousSibling while sibling if node.nodeType 1 path.push node.nodeName.toLowerCase node.id @id ' node.id ' count 0 count '' return path script function to get xpath..
get text of an element without children in javascript http://stackoverflow.com/questions/9955955/get-text-of-an-element-without-children-in-javascript .slice 0 text.split .length 1 .reverse .join text.split text.split .length 1 text.split .reverse .join edit using node.nodeType doesn't really help and here's why Imaginge the following HTML td class gensmall Last visit was Sat Mar 31 2012 10 50 am..
|