<body>
<div id="d"></div>
<script>
document
.getElementById("d")
.addEventListener("test", () => console.log("div"), true);
document.body.addEventListener("test", () => console.log("body"), true);
window.addEventListener("test", () => console.log("window"));
window.dispatchEvent(new CustomEvent("test"));
</script>
</body>
Run the above code, you will only see one output. Run the above code, you will only see one output. Run the above code, you will only see one output. Run the above code, you will only see one output. Run the above code, you will only see one output. Run the above code, you will only see one output.
Aucun commentaire:
Enregistrer un commentaire