Skip to content

Commit d5c513e

Browse files
committed
Improve span highlighting reliability
1 parent d0b041d commit d5c513e

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

html-api-debugger/view.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,17 @@ const store = createStore(NS, {
267267

268268
/** @param {MouseEvent} e */
269269
handleSpanOver(e) {
270-
const t = /** @type {HTMLElement} */ (e.target);
271-
const { spanStart, spanLength } = t.dataset;
272-
if (!t || !spanStart || !spanLength) {
270+
const target = /** @type {HTMLElement} */ (e.target);
271+
/** @type {HTMLElement|null} */
272+
const spanElement = target.dataset['spanStart']
273+
? target
274+
: target.closest('[data-span-start]');
275+
276+
if (!spanElement) {
277+
return;
278+
}
279+
const { spanStart, spanLength } = spanElement.dataset;
280+
if (!spanStart || !spanLength) {
273281
return;
274282
}
275283

0 commit comments

Comments
 (0)