Skip to content

Commit e62ca0d

Browse files
committed
Fixed issue when moving the selection with an empty output.
1 parent c63f903 commit e62ca0d

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

main.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -222,13 +222,15 @@ function updateSelection() {
222222

223223
outputs.forEach(code => {
224224
const thisNode = code;
225-
const fromLine = parseInt(thisNode.getAttribute('data-from-line'), 10);
226-
const toLine = parseInt(thisNode.getAttribute('data-to-line'), 10);
227-
if ((fromLine <= selectedTo) && (toLine >= selectedFrom)) {
228-
code.classList.add('highlight');
229-
code.scrollIntoView({ block: 'nearest', inline: 'start' });
230-
} else {
231-
code.classList.remove('highlight');
225+
if (thisNode.getAttribute){
226+
const fromLine = parseInt(thisNode.getAttribute('data-from-line'), 10);
227+
const toLine = parseInt(thisNode.getAttribute('data-to-line'), 10);
228+
if ((fromLine <= selectedTo) && (toLine >= selectedFrom)) {
229+
code.classList.add('highlight');
230+
code.scrollIntoView({ block: 'nearest', inline: 'start' });
231+
} else {
232+
code.classList.remove('highlight');
233+
}
232234
}
233235
});
234236
}

0 commit comments

Comments
 (0)