Content deleted Content added
new architecture for the code: combine first- and second-pass loops |
undo radical change for now |
||
Line 47:
// First-pass loop colors the links and adds the level to the beginning
diagnostic_string = "";
for (DD_element_index=
temp_DD_element = DD_elements[DD_element_index
num_sub_DL_elements = temp_DD_element.getElementsByTagName("DL").length;
// Skip empty DD elements
Line 58 ⟶ 57:
//Alternative approach: skip all DD elements that have a sub DL element within
untagged_text = untagged_text.replace(/(<([^>]+)>)/ig,""); // remove other HTML tags
unspaced_text = untagged_text.replace(/\s/ig, ""); // remove whitespaces
byte_count = unspaced_text.length; // remove whitespaces
if (byte_count < 1) { continue; }
// Find the topmost DL element for this DD node
Line 109:
diagnostic_string += "DD element " + DD_element_index + " is indented to level " + indent_level + ".\n";
} // check for unindenting
} // closes loop over the DD elements of the document
// window.alert(diagnostic_string);
// Second-pass loop changes the document tree structure
diagnostic_string = "";
Line 183 ⟶ 164:
} // closes loop over the DD elements of the document
// window.alert(diagnostic_string);
// Third-pass loop to uncreate empty discursive lists
|