File tree 1 file changed +20
-13
lines changed
1 file changed +20
-13
lines changed Original file line number Diff line number Diff line change @@ -504,19 +504,26 @@ const Tooltip = ({
504
504
if ( activeAnchor ) {
505
505
const elements = [ ...mutation . removedNodes ] . filter ( ( node ) => node . nodeType === 1 )
506
506
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
+ }
520
527
}
521
528
elements . some ( ( node ) => {
522
529
if ( node ?. contains ?.( activeAnchor ) ) {
You can’t perform that action at this time.
0 commit comments