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