Fix #205: guard splitLines() when server HTML has no newlines so renumber runs
This commit is contained in:
@@ -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++) {
|
||||
|
||||
Reference in New Issue
Block a user