summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-01-21 09:40:12 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2015-01-21 09:45:13 -0800
commitf499e4f2be96ec56844afcc59c3db26038066d27 (patch)
tree3d738758e6922db59c7f50cee5bd2aafe414eb02
parent625c93769b81938781ba19450b15debd4ef7e396 (diff)
Propagate lastLineBlank up through parents.
Previously we just kept it set on the bottom child. But this will give a quicker determination of lastLineBlank.
-rw-r--r--js/lib/blocks.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/js/lib/blocks.js b/js/lib/blocks.js
index abaea17..23b0283 100644
--- a/js/lib/blocks.js
+++ b/js/lib/blocks.js
@@ -506,16 +506,17 @@ var incorporateLine = function(ln) {
// and we don't count blanks in fenced code for purposes of tight/loose
// lists or breaking out of lists. We also don't set _lastLineBlank
// on an empty list item, or if we just closed a fenced block.
- container._lastLineBlank = blank &&
+ var lastLineBlank = blank &&
!(t === 'BlockQuote' ||
(t === 'CodeBlock' && container._isFenced) ||
(t === 'Item' &&
!container._firstChild &&
container.sourcepos[0][0] === this.lineNumber));
+ // propagate lastLineBlank up through parents:
var cont = container;
- while (cont._parent) {
- cont._parent._lastLineBlank = false;
+ while (cont) {
+ cont._lastLineBlank = lastLineBlank;
cont = cont._parent;
}