This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 25907 - Need initMessageEvent method because https://github.com/whatwg/dom/commit/333b03cf6454e803d6433673c33f1292821dac0a
Summary: Need initMessageEvent method because https://github.com/whatwg/dom/commit/333...
Status: RESOLVED FIXED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-28 07:43 UTC by contributor
Modified: 2014-09-11 23:13 UTC (History)
5 users (show)

See Also:


Attachments

Description contributor 2014-05-28 07:43:48 UTC
Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html
Multipage: http://www.whatwg.org/C#messageevent
Complete: http://www.whatwg.org/c#messageevent
Referrer: http://www.whatwg.org/specs/web-apps/current-work/multipage/

Comment:
Need initMessageEvent method because
https://github.com/whatwg/dom/commit/333b03cf6454e803d6433673c33f1292821dac0a

Posted from: 90.230.218.37 by simonp@opera.com
User agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.114 Safari/537.36 OPR/22.0.1471.40 (Edition Next)
Comment 1 Anne 2014-05-28 11:21:41 UTC
It seems Gecko successfully removed that method. Why should we add it? I don't think things need to make sense for document.createEvent() users.
Comment 2 Simon Pieters 2014-05-28 11:56:53 UTC
I mean sites that use document.createEvent('messageevent') will most likely break if initMessageEvent doesn't exist. But if Gecko's experience is that the breakage is small enough and Blink is successful with removing it also, then sure, but then I think there's no point in having document.createEvent('messageevent') in DOM either.
Comment 4 Arkadiusz Michalski (Spirit) 2014-05-28 13:12:33 UTC
Its strange that this list was extended:
https://github.com/whatwg/dom/commit/333b03cf6454e803d6433673c33f1292821dac0a

Before we have only:
CustomEvent
Event
MouseEvent
UIEvent

Now:
CustomEvent
Event
KeyboardEvent
MessageEvent
MouseEvent
TouchEvent
UIEvent

Event, MouseEvent and UIEvent has defined init*methods in D2E spec so still may be acceptable. Now DOM (only for Event and CustomEvent) and D3E (draft) define some other init*methods:

https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#legacy-event-initializers

The level of support these methods by different browsers is really chaotic and probably the only constructors finally change this situation.

Without dedicated initializer we can only use universal initEvent() and dispatch this event, but in practice (without posibility set some properties) its nonsens.

And for TouchEvent we have this in spec. (https://dvcs.w3.org/hg/webevents/raw-file/v1/touchevents.html#h_note_3):

"Some user agents implement an initTouchEvent method as part of the TouchEvent interface. When this method is available, scripts can use it to initialize the properties of a TouchEvent object, including its TouchList properties (which can be initialized with values returned from createTouchList). The initTouchEvent method is not yet standardized, but it may appear in some form in a future specification."

So still without any details of how such a method should look like.

In general adding more events for document.createEvent() but without dedicated initializer method (which are supported by browsers in the same way) is realy strange, especially if the trend is to remove (or limit) init*methods and use only constructors.
Comment 5 Anne 2014-05-28 13:33:23 UTC
They were added because zcorpan reported usage of them in the bug associated with that change. I don't think that necessarily means we have to add corresponding init*Event() methods back. If they can stay gone, that's fine. If that means we try removing "messageevent" as argument again, fine. This part of the specification is still a bit experimental as it's only been a few years since we switched away from this model.
Comment 6 Ian 'Hixie' Hickson 2014-05-28 17:57:33 UTC
Is there any point to creating the event that way if it can't be initialised?
Comment 7 Simon Pieters 2014-06-02 05:55:41 UTC
https://github.com/search?l=javascript&q=createevent+messageevent&ref=searchresults&type=Code 19,392
https://github.com/search?l=javascript&q=initmessageevent&ref=searchresults&type=Code 19,393

It seems to me that sites that use createEvent('messageevent') always also use initMessageEvent.
Comment 8 Ian 'Hixie' Hickson 2014-06-02 18:15:33 UTC
That makes more sense.
Comment 9 contributor 2014-08-05 22:33:45 UTC
Checked in as WHATWG revision r8711.
Check-in comment: Add initMessageEvent()
http://html5.org/tools/web-apps-tracker?from=8710&to=8711
Comment 10 Anne 2014-08-06 08:26:35 UTC
"in <span>MessagePort</span>[]? portsArg"

"in " has been obsolete for a long time.

"<span>MessagePort</span>[]" should become "sequence&lt;<span>MessagePort</span>>"
Comment 11 contributor 2014-09-11 23:13:22 UTC
Checked in as WHATWG revision r8760.
Check-in comment: Fix IDL for initMessageEvent()
http://html5.org/tools/web-apps-tracker?from=8759&to=8760