You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Web] tolerate empty e.target in addTargetBlankToExternalLinks (#2555)
## Motivation for the change, related issues
A user reported the following error coming from the
`addTargetBlankToExternalLinks` function:
```
JavaScript Error: TypeError: e.target.closest is not a function https://playground.wordpress.net/scope:0.7531680412299814/wp-admin/post.php?post=5&action=edit:570:24
```
It could happen when another event listener removes the `e.target` node
before the event bubbles up to the `document` node.
This PR makes sure an empty `e.target` is tolerated and short-circuits
without an error.
cc @draganescu
0 commit comments