Closed Bug 1388069 Opened 2 years ago Closed 2 years ago

Support createEvent("FocusEvent")

Categories

(Core :: DOM: Events, enhancement)

enhancement
Not set

Tracking

()

RESOLVED FIXED
mozilla57
Tracking Status
firefox57 --- fixed

People

(Reporter: ayg, Assigned: ayg)

Details

(Keywords: dev-doc-complete)

Attachments

(1 file)

After a lot of discussion at <https://github.com/whatwg/dom/issues/362>, we agreed to remove support for a bunch of event types from the list supported in createEvent().  The new list in the spec matches our own exactly, except that it includes FocusEvent, because Chrome usage counters show high usage: <https://www.chromestatus.com/metrics/feature/timeline/popularity/1171>  Currently about 0.04% of pages do createEvent("FocusEvent") in Chrome, which is high enough they'd prefer not to drop support.  Possibly these pages break somehow in Firefox as well.  Either way, I think it's fine for us to add support for this one event type.
Sorry, we actually still support some events that the spec doesn't, just FocusEvent is the only type that the spec says to support that we don't.
So when creating the event with createEvent(), it initializes the .type to "focus" instead of "", which causes test failures.  I tried looking through the source code a lot until I gave up.  Do you know how to fix it?
Flags: needinfo?(bugs)
What kind of patch do you have?
Do you need something like http://searchfox.org/mozilla-central/rev/b52285fffc13f36eca6b47de735d4e4403b3859e/dom/events/EventDispatcher.cpp#1017 ?
Flags: needinfo?(bugs)
I forgot to add, I deliberately didn't add telemetry for this, because I think the decision to add the event is final.  If we ever want to consider dropping it and are worried about usage, we could always add telemetry then.
Comment on attachment 8894577 [details]
Bug 1388069 - Support createEvent("FocusEvent");

https://reviewboard.mozilla.org/r/165734/#review170860

Sorry, but this has tons of unrelated stuff. Could you just upload a patch for this particular bug.
Attachment #8894577 - Flags: review?(bugs) → review-
Comment on attachment 8894577 [details]
Bug 1388069 - Support createEvent("FocusEvent");

https://reviewboard.mozilla.org/r/165734/#review171298
Attachment #8894577 - Flags: review?(bugs) → review+
Pushed by ayg@aryeh.name:
https://hg.mozilla.org/integration/autoland/rev/e6fb60951529
Support createEvent("FocusEvent"); r=smaug
https://hg.mozilla.org/mozilla-central/rev/e6fb60951529
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
On MDN, we have a createEvent() page:

https://developer.mozilla.org/en-US/docs/Web/API/Document/createEvent

However, we don't cover the different types of event in detail; we just say how the method is used, link to the DOM standard for the full list of event types that can be created, and then recommend that developers use event object constructors instead. This being the case, I don't think there is all that much update in the docs.

I have however added a note to the Fx57 rel notes to cover it:

https://developer.mozilla.org/en-US/Firefox/Releases/57#DOM
You need to log in before you can comment on or make changes to this bug.