The default bug view has changed. See this FAQ.

Implement CustomEvent DOM3 specification

RESOLVED FIXED in mozilla6

Status

()

Core
DOM: Events
--
enhancement
RESOLVED FIXED
9 years ago
6 years ago

People

(Reporter: Aleks Totic, Assigned: smaug)

Tracking

({dev-doc-complete})

Trunk
mozilla6
dev-doc-complete
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(1 attachment)

(Reporter)

Description

9 years ago
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.
(Assignee)

Comment 1

9 years ago
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
(Reporter)

Comment 2

9 years ago
Thanks for the tip about datacontainerevent. I wish I found about them earlier.
Blocks: 554013

Updated

7 years ago

Comment 3

6 years ago
I made a workaround for until this gets fixed: https://gist.github.com/961460
(Assignee)

Updated

6 years ago
Assignee: nobody → Olli.Pettay
(Assignee)

Comment 4

6 years ago
Created attachment 531057 [details] [diff] [review]
patch
Attachment #531057 - Flags: review?(jonas)
Attachment #531057 - Flags: review?(jonas) → review+
(Assignee)

Comment 5

6 years ago
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
Last Resolved: 6 years ago
Resolution: --- → FIXED

Updated

6 years ago
Keywords: dev-doc-needed
Target Milestone: --- → mozilla6

Updated

6 years ago
Keywords: dev-doc-needed → dev-doc-complete

Comment 6

6 years ago
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.

Comment 7

6 years ago
Ok I think it's good now.

Updated

6 years ago
Depends on: 697300

Updated

6 years ago
No longer depends on: 697300
You need to log in before you can comment on or make changes to this bug.