User:Proteins/unindent.js: Difference between revisions

Content deleted Content added
Proteins (talk | contribs)
remove diagnostic messages
Proteins (talk | contribs)
refine the conditional to eliminate DD elements used only for formatting
Line 52:
if (!num_child_nodes) { continue; } // ignore empty DD elements
 
//Alternative approach: skip all DD elements that have a sub DL element within
untagged_text = temp_DD_element.innerHTML.replace(/(<dl([^>]+*)>)(.*?<\/dl>)/ig,""); // remove inner DL's
untagged_text = untagged_text.replace(/(<([^>]+)>)/ig,""); // remove other HTML tags
byte_count = untagged_text.replace(/\s/ig, "").length; // remove whitespaces
Line 96 ⟶ 97:
temp_DD_element.appendChild(document.createTextNode(indent_level_string));
}
temp_DD_element.normalize();
diagnostic_string += "DD element " + DD_element_index + " is indented to level " + indent_level + ".\n";
} // check for unindenting