Why does this small piece of code run unsteadily?

The

event binds a function, and when blur occurs, alert enters tagName

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
<table>
    <tr>
        <td>goods1</td>
        <td><input type="text" name="goods1"></td>
    </tr>
    <tr>
        <td>goods2</td>
        <td><input type="text" name="goods2"></td>
    </tr>
</table>
<script>
function mouse_out(event){
    ob = event.target;
    alert(ob.tagName);
    }
document.addEventListener("blur",mouse_out,true);
</script>
</body>
</html>

this code runs 10 times, and one of them has a special failure, and the alert window cannot be closed, which is particularly strange. For the screen copy of
in case of failure, please see
extraction Code: ii6k

or see
https://www.dropbox.com/s/szm.

here

this js is so short and mundane that it sometimes runs with strange problems, and the alert window cannot be closed (once happened 10 times, and you will see the situation shown in the test.avi I sent over and over again). I also doubt my life

.
function mouse_out(event){
    ob = event.target;
    alert(ob.tagName);
    }
document.addEventListener("blur",mouse_out,true);
Oct.21,2021

do not bind events to document, because there are so many events on it that more than 99% will not be what you want to capture. To bind to ancestor nodes as close as possible, avoid frequently binding event handlers and catching events that are not related to elements.
the reason for your problem is that alert causes blur events on the document to be triggered frequently, so, debugging do not use alert , use console


, it is not impossible to close, it is the event blur to respond repeatedly, click the first text and then click the second text will be like this, click the first text and then click elsewhere will not, as said upstairs, you bind the event to document.


you bind the event to the document event, which constantly triggers your out-of-focus event.
clipboard.png you can try this

.
Menu