Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spec sending prefixed animation and transition events #24

Closed
miketaylr opened this issue Jan 6, 2016 · 13 comments
Closed

Spec sending prefixed animation and transition events #24

miketaylr opened this issue Jan 6, 2016 · 13 comments

Comments

@miketaylr
Copy link
Member

cf. https://bugzilla.mozilla.org/show_bug.cgi?id=1236979 and https://bugzilla.mozilla.org/show_bug.cgi?id=1236930.

A popular mapping library, Leaflet.js, when it tests for transitionEnd event prefixes prefers webkitTransitionEnd because some Android browsers had unprefixed CSS transition but not an unprefixed transitionEnd event. 😭

It seems in order to be compatible with this content—for UAs that do alias -webkit-transition— they need to also send webkitTransitionEnd events. Boo.

See Leaflet/Leaflet#1182 and associated commit.

@miketaylr
Copy link
Member Author

https://bugzilla.mozilla.org/show_bug.cgi?id=1236979 landed in Firefox Nightly today (and fixes the issuses we found).

@miketaylr
Copy link
Member Author

+// Webkit-prefixed versions of Transition & Animation events, for web compat:
+NON_IDL_EVENT(webkitTransitionEnd,
+              eWebkitTransitionEnd,
+              EventNameType_None,
+              eTransitionEventClass)
+NON_IDL_EVENT(webkitAnimationEnd,
+              eWebkitAnimationEnd,
+              EventNameType_None,
+              eAnimationEventClass)
+NON_IDL_EVENT(webkitAnimationIteration,
+              eWebkitAnimationIteration,
+              EventNameType_None,
+              eAnimationEventClass)
+NON_IDL_EVENT(webkitAnimationStart,
+              eWebkitAnimationStart,
+              EventNameType_None,
+              eAnimationEventClass)

@miketaylr miketaylr changed the title Sending prefixed DOM events? Spec sending prefixed animation and transitions events Feb 3, 2016
@miketaylr miketaylr changed the title Spec sending prefixed animation and transitions events Spec sending prefixed animation and transition events Feb 3, 2016
@miketaylr
Copy link
Member Author

Rather than send these prefixed events all the time, do this iff there are listeners for those prefixed events and a standard event hasn't been fired on that element already.

  • If any 'transitionend' listeners exist on a node, invoke them.
  • Otherwise, if any 'webkitTransitionEnd' listeners exist on this node, invoke them.

@annevk
Copy link
Member

annevk commented Feb 3, 2016

How does that work with respect to bubbling and capturing?

@miketaylr
Copy link
Member Author

See https://bugzilla.mozilla.org/show_bug.cgi?id=1236979#c38 -- I should test that this works for capturing too. (Unless @dholbert already did)

@annevk
Copy link
Member

annevk commented Feb 3, 2016

Oh wow that behavior seems fairly magical. How would you specify that without changing the event dispatch algorithm somehow? @smaug----?

@miketaylr
Copy link
Member Author

🎩 Magic. ✨

@smaug----
Copy link

You need to change event dispatch algorithm. What Gecko has now should be the same what Chrome has for webkit prefixed events:
https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/core/events/EventTarget.cpp&sq=package:chromium&l=351&dr=C&rcl=1452688339

Yes, we are actually changing the event type while calling prefixed listeners. Absolutely horrible, but that is that blink and webkit folks have decided to do, and doesn't make sense to have different setup for these prefixed events in Gecko.

See also https://bugs.webkit.org/show_bug.cgi?id=115656

@miketaylr
Copy link
Member Author

Edge has also implemented this -- based on https://bug1236979.bmoattachments.org/attachment.cgi?id=8707180.

edit: IE11 too, it seems.

@annevk
Copy link
Member

annevk commented Feb 3, 2016

Okay, so it seems like we should add this to the DOM Standard directly then @miketaylr. No need to hide the ugly.

@miketaylr
Copy link
Member Author

@annevk SGTM.

@miketaylr
Copy link
Member Author

Closing here in favor of whatwg/dom#156.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants