当我快速单击dom元素时,有时不会每次触发它的mouseleave事件。我确定我不会让鼠标离开该元素。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
.outer{
width: 500px;
height: 500px;
background: #f00;
}
</style>
</head>
<body>
<div class="outer">
</div>
<script>
const outer = document.querySelector('.outer');
outer.addEventListener('mouseleave',function () {
console.log('mouseleave')
})
</script>
</body>
</html>
我希望仅当鼠标离开元素时才触发mouseleave事件。