function highlightRecursive(node){
        console.log("nodeType=" + node.nodeType + " tagName=" + node.tagName);
        
        // ignore space and text ... we are only interested in element nodes
        if (node.nodeType = 1){
            var tag = node.tagName;
            var newNode = document.createElement("span");
            // add a new span element that will display element name
            newNode.className='hoverNode';
            var newText = document.createTextNode(tag);
            newNode.appendChild(newText); 
        }
        var childNodes = node.childNodes;
        for (var j = 0; j < childNodes.length; j++) {
            highlightRecursive(childNodes[j]);
        }
        if (node.nodeType!=3){
            newNode.addEventListener('click',alertDetails);
            node.appendChild(newNode);
        }
    }
/*
       This function recursively goes through all nodes (from the one passed in) 
       and adds extra clickable divs to display what kind of HTMl tag this is.
    */
This function recursively goes through all nodes (from the one passed in)
and adds extra clickable divs to display what kind of HTMl tag this is.
This function recursively goes through all nodes ( from the one passed in ) and adds extra clickable divs to display what kind of HTMl tag this is .
function highlightRecursive(node){
        console.log("nodeType=" + node.nodeType + " tagName=" + node.tagName);
        if (node.nodeType = 1){
            var tag = node.tagName;
            var newNode = document.createElement("span");
            newNode.className='hoverNode';
            var newText = document.createTextNode(tag);
            newNode.appendChild(newText); 
        }
        var childNodes = node.childNodes;
        for (var j = 0; j < childNodes.length; j++) {
            highlightRecursive(childNodes[j]);
        }
        if (node.nodeType!=3){
            newNode.addEventListener('click',alertDetails);
            node.appendChild(newNode);
        }
    }
function highlightRecursive ( node ) { console . log ( "nodeType=" + node . nodeType + " tagName=" + node . tagName ) ; if ( node . nodeType = 1 ) { var tag = node . tagName ; var newNode = document . createElement ( "span" ) ; newNode . className = 'hoverNode' ; var newText = document . createTextNode ( tag ) ; newNode . appendChild ( newText ) ; } var childNodes = node . childNodes ; for ( var j = 0 ; j < childNodes . length ; j ++ ) { highlightRecursive ( childNodes [ j ] ) ; } if ( node . nodeType != 3 ) { newNode . addEventListener ( 'click' , alertDetails ) ; node . appendChild ( newNode ) ; } }
This function recursively goes through all nodes (from the one passed in)
and adds extra clickable divs to display what kind of HTMl tag this is.
This function recursively goes through all nodes ( from the one passed in ) and adds extra clickable divs to display what kind of HTMl tag this is .
// ignore space and text ... we are only interested in element nodes // add a new span element that will display element name