Revision: 3621
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at August 23, 2007 06:47 by micmath
Initial Code
function getPrevious(el) { function isIgnorable(node) { // is a comment or contains only whitespace return (node.nodeType == 8 || /^[\t\n\r ]+$/.test(node.data)); } var prev = el; while (prev = prev.previousSibling) { if (!isIgnorable(prev)) break; } return prev; }
Initial URL
Initial Description
This ignores whitespace and comments.
Initial Title
Get previous node.
Initial Tags
Initial Language
JavaScript