Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit 83d39b7

Browse files
committed
Adjust code style in 1eb5358
Issue #51
1 parent 1eb5358 commit 83d39b7

1 file changed

Lines changed: 8 additions & 15 deletions

File tree

src/from_dom.js

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,8 @@ class NodeContext {
302302
this.activeMarks = Mark.none
303303
// Marks that can't apply here, but will be used in children if possible
304304
this.pendingMarks = pendingMarks
305-
// Nested Marks with same type
306-
this.stashMarks = [];
305+
// Nested Marks with same type
306+
this.stashMarks = []
307307
}
308308

309309
findWrapping(node) {
@@ -340,12 +340,8 @@ class NodeContext {
340340
}
341341

342342
popFromStashMark(markType) {
343-
for (let i = this.stashMarks.length - 1; i >= 0; i--) {
344-
if (this.stashMarks[i].type == markType) {
345-
return this.stashMarks.splice(i, 1)[0];
346-
}
347-
}
348-
return undefined
343+
for (let i = this.stashMarks.length - 1; i >= 0; i--)
344+
if (this.stashMarks[i].type == markType) return this.stashMarks.splice(i, 1)[0]
349345
}
350346

351347
applyPending(nextType) {
@@ -710,7 +706,7 @@ class ParseContext {
710706
}
711707

712708
addPendingMark(mark) {
713-
const found = this.top.pendingMarks.findIndex(_mark => _mark.type == mark.type)
709+
let found = this.top.pendingMarks.findIndex(_mark => _mark.type == mark.type)
714710
if (found > -1) this.top.stashMarks.push(mark)
715711
this.top.pendingMarks = mark.addToSet(this.top.pendingMarks)
716712
}
@@ -722,12 +718,9 @@ class ParseContext {
722718
if (found > -1) {
723719
level.pendingMarks = mark.removeFromSet(level.pendingMarks)
724720
} else {
725-
const stashMark = level.popFromStashMark(mark.type);
726-
if (stashMark) {
727-
level.activeMarks = stashMark.addToSet(level.activeMarks);
728-
} else {
729-
level.activeMarks = mark.removeFromSet(level.activeMarks);
730-
}
721+
level.activeMarks = mark.removeFromSet(level.activeMarks)
722+
let stashMark = level.popFromStashMark(mark.type)
723+
if (stashMark) level.activeMarks = stashMark.addToSet(level.activeMarks)
731724
}
732725
if (level == upto) break
733726
}

0 commit comments

Comments
 (0)