[webkit-help] Strange behavior in dispatchEvent and CustomEvents

Eduardo Felipe eduardofelipe87 at gmail.com
Thu Jun 10 12:27:18 PDT 2010


Hi folks,

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. In my opinion it should. Am I doing something wrong?


Cheers

Eduardo Felipe


More information about the webkit-help mailing list