Cleanup code, remove console log debugs.

This commit is contained in:
VonC 2013-10-26 22:33:43 +02:00
parent 28198b2ff0
commit 7aa93af0ca
1 changed files with 11 additions and 18 deletions

View File

@ -284,23 +284,18 @@
if ( matches = mardownClassesInElementsRegex.exec( nodeValue ) ) {
var classes = matches[1];
console.log("'" + classes + "'");
nodeValue = nodeValue.substring(0,matches.index) + nodeValue.substring(mardownClassesInElementsRegex.lastIndex) + "ee";
console.log("'" + nodeValue + "'");
nodeValue = nodeValue.substring( 0, matches.index ) + nodeValue.substring( mardownClassesInElementsRegex.lastIndex );
node.nodeValue = nodeValue;
console.log("'" + elementTarget.tagName + "'");
while( matchesClass = mardownClassRegex.exec( classes ) ) {
console.log("attr='" + matchesClass[1] + "'='" + matchesClass[2] + "'");
elementTarget.setAttribute(matchesClass[1], matchesClass[2]);
console.log("=>'" + elementTarget.attributes[matchesClass[1]].nodeValue + "'");
}
}
}
/**
* Add classes to the parent element of a text node
* From http://stackoverflow.com/questions/9178174/find-all-text-nodes
* Add attributes to the parent element of a text node,
* or the element of an attribute node.
*/
function addAttributes( element )
{
@ -312,17 +307,15 @@
}
var nodeValue;
var elementTarget;
// From http://stackoverflow.com/questions/9178174/find-all-text-nodes
if ( element.nodeType == Node.TEXT_NODE && /\S/.test(element.nodeValue) ) {
addAttributeInElement( element, element.parentNode );
}
if ( element.nodeType == Node.ELEMENT_NODE && element.attributes.length > 0 ) {
console.log("Element '" + element.tagName + "' has " + element.attributes.length + " attributes");
for ( iattr=0; iattr<element.attributes.length; iattr++ ){
var attr = element.attributes[iattr];
console.log("Check attr '" + attr + "', name='" + attr.name + "'='" + attr.value + "'");
addAttributeInElement(attr, element)
}
console.log("<== Element '" + element.tagName + "' had " + element.attributes.length + " attributes");
}
}