Node.js examples for DOM:Node
Collapses/Expands the node
/**/*from www .j av a 2 s . c om*/ * Collapses/Expands the node * @param ele */ function toggleNodes(ele){ var divE = (hasClass(ele,'e') ? ele : findParentByClassName(ele,'e')); //don't toggle self-closing elements if (!hasClass(divE.firstElementChild,'nsc')) { var divC = divE.getElementsByClassName('c')[0]; if (divE.className.indexOf('hidden') > -1){ var spanClosed = divE.getElementsByClassName('closed')[0]; divE.removeChild(spanClosed); divC.style.display=''; divE.className = divE.className.replace(' hidden',''); }else{ divC.style.display='none'; divE.className += ' hidden'; var closed = createNodeStructure('http://www.w3.org/1999/xhtml','span','class','closed','...'); divC.parentNode.insertBefore(closed,divC); } } }