Closed Bug 427537 Opened 14 years ago Closed 11 years ago
Event DOM3 specification
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9b5) Gecko/2008032620 Firefox/3.0b5 Build Identifier: CustomEvent is a DOM3 specification, and would make generated events a lot more powerful if implemented. We use js-generated events in XUL for TabOpen, TabClose etc. With current DOM API (createEvent/initEvent), you can't pass any arguments with the event. With CustomEvent API, an extra detail argument is allowed, making events a lot more useful. Trivial example, TabOpen could specify which tab got opened. Reproducible: Always Steps to Reproduce: 1. 2. 3.
DOM 3 Events is still just a *draft* and there will be changes for sure. (For example I'm going to propose to change CustomEvent interface a bit). On FF3 extension/chrome developers (well, also web developers could, but it isn't recommended) can use gecko-only nsIDOMDataContainerEvent. http://lxr.mozilla.org/seamonkey/source/dom/public/idl/events/nsIDOMDataContainerEvent.idl That is actually more flexible than CustomEvent, because it may contain any number any kind of data, identified using a string key. var evt = document.createEvent("datacontainerevents"); evt.initEvent("SomeEventName", true, true); evt.setData("key", "somevalue"); This bug is valid, but just shouldn't be fixed before DOM 3 Events is a bit more stable.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Thanks for the tip about datacontainerevent. I wish I found about them earlier.
I made a workaround for until this gets fixed: https://gist.github.com/961460
Attachment #531057 - Flags: review?(jonas) → review+
http://hg.mozilla.org/mozilla-central/rev/47f42f84ba96 But I managed to mess up with the hg summary. Fortunately the bug number is there.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla6
trevorh, CustomEvent is an Event class, not a method called document.customEvent(). I've deleted all of your documentation and I'll try to document it myself (the new page is https://developer.mozilla.org/En/DOM/Event/CustomEvent), though I'm not that experienced with MDN page guidelines.
Ok I think it's good now.
You need to log in before you can comment on or make changes to this bug.