Fix #205: guard splitLines() against newline-less server HTML so renumber runs #219

Closed
fen wants to merge 1 commits from fix-205-r2 into dev
Showing only changes of commit 555e5b30be - Show all commits
+7
View File
@@ -20,6 +20,13 @@
// box per line, which would shift every following number down one row (#167).
function splitLines() {
var html = body.innerHTML;
if (html.indexOf('\n') < 0) {
// No newline text nodes to split on (already joined in the server
// template or stripped upstream): blocks are already adjacent, so
// leave the DOM alone. Splitting here would clone the whole markup
// into one block and leave renumber() reading stale nodes (#205).
return;
}
var parts = html.split('\n');
var out = [];
for (var i = 0; i < parts.length; i++) {