File tree Expand file tree Collapse file tree 1 file changed +20
-13
lines changed Expand file tree Collapse file tree 1 file changed +20
-13
lines changed Original file line number Diff line number Diff line change @@ -504,19 +504,26 @@ const Tooltip = ({
504504 if ( activeAnchor ) {
505505 const elements = [ ...mutation . removedNodes ] . filter ( ( node ) => node . nodeType === 1 )
506506 if ( selector ) {
507- removedAnchors . push (
508- // the element itself is an anchor
509- ...( elements . filter ( ( element ) =>
510- ( element as HTMLElement ) . matches ( selector ) ,
511- ) as HTMLElement [ ] ) ,
512- )
513- removedAnchors . push (
514- // the element has children which are anchors
515- ...elements . flatMap (
516- ( element ) =>
517- [ ...( element as HTMLElement ) . querySelectorAll ( selector ) ] as HTMLElement [ ] ,
518- ) ,
519- )
507+ try {
508+ removedAnchors . push (
509+ // the element itself is an anchor
510+ ...( elements . filter ( ( element ) =>
511+ ( element as HTMLElement ) . matches ( selector ) ,
512+ ) as HTMLElement [ ] ) ,
513+ )
514+ removedAnchors . push (
515+ // the element has children which are anchors
516+ ...elements . flatMap (
517+ ( element ) =>
518+ [ ...( element as HTMLElement ) . querySelectorAll ( selector ) ] as HTMLElement [ ] ,
519+ ) ,
520+ )
521+ } catch {
522+ /**
523+ * invalid CSS selector.
524+ * already warned on tooltip controller
525+ */
526+ }
520527 }
521528 elements . some ( ( node ) => {
522529 if ( node ?. contains ?.( activeAnchor ) ) {
You can’t perform that action at this time.
0 commit comments