Closed Bug 77251 Opened 25 years ago Closed 25 years ago

document.createEvent() uses wrong event type strings

Categories

(Core :: DOM: Events, defect)

defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla0.9.1

People

(Reporter: david, Assigned: joki)

Details

(Keywords: dom2, Whiteboard: [fixinhand])

Attachments

(1 file)

document.createEvent() is currently implemented to work with singular event type strings: "HTMLEvent", "MutationEvent", and so on. This seems sensible, but the spec actually requires plural strings: "MutationEvents", "HTMLEvents", and so on. The string passed to createEvent() is the same one passed to document.implementation.hasFeature() to check whether an event module is supported. See for example section 1.6.4 of the DOM Level 2 Eevent spec. It says: "Note: To create an instance of the MutationEvent interface, use the feature string 'MutationEvents' as the value of the input parameter used with the createEvent method..." Since this is likely to be a source of programmer confusion, my suggestion is to make createEvent() work with both singular and plural strings. [As an aside, note that createEvent() isn't working at all in Moz 0.8.1: when I pass a correct plural string, it throws an exception. When I pass a singular string it simply returns null! There seem to be other bugs pending about this.]
Keywords: dom2
Status: UNCONFIRMED → NEW
Ever confirmed: true
Easy fix for 0.9.1
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla0.9.1
So, hyatt fixed the creation of MutationEvents in 75024, changing only the string for MutationEvents to plural, but only for MutationEvents. MouseEvent, KeyEvent, HTMLEvent and Event are still singular. confusion goodness. Adding both Heikki (reporter) and Hyatt (fixer (ugh, what a word)) from 75024. Axel
sr=hyatt
r=jst
document.createEvent(pluralParameter)? Craziness. Anyone interested in David's suggestion to support both? Ian, any idea about the logic behind this naming?
Fixed
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
verifying on build 2001-05-04-04-trunk windows 98
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: