DOM Level 3 CustomEvents not bubbling on WebKit
- by Edu Felipe
I'm observing CustomEvents not bubbling, even though I set bubbling to true. The code below:
var evt = document.createEvent("CustomEvent")
evt.initCustomEvent("mycustomevent", true, false)
var someh1 = document.getElementById("someh1")
someh1.addEventListener("mycustomevent", function(){ alert("OMG!"); })
document.getElementsByTagName("body")[0].dispatchEvent(evt)
With the HTML below:
<html>
<head></head>
<body>
<h1 id="someh1">content!</h1>
</body>
</html>
Never shows the alert, demonstrating that the event is not bubbling down. Am I doing something wrong?
Please note that if I do a getElementById("someh1") and run the dispatchEvent on it, the alert is displayed.
Thanks!