The button button under Firefox has a child element canvas to bind the click event to canvas, and the click is invalid. What is the reason for this?

The button button under

Firefox has a child element canvas to bind the click event to canvas, and the click is invalid. What is the reason for this? Just change the button tag to div . The test code is as follows:

<body>
<button>
   <canvas id="cav" style="width: 100px; height: 100px; border: 1px solid -sharp000;"></canvas>
</button>
</body>
<script>
 var a = document.getElementById("cav");
 a.onclick = function() {
    console.log("aaa"); // Firefox / IE9+ 
 }
</script>
Jun.16,2021
Menu