Bug 18542 - onmousewheel attribute should be replaced with onwheel
onmousewheel attribute should be replaced with onwheel
Status: REOPENED
Product: HTML WG
Classification: Unclassified
Component: HTML5 spec
unspecified
All All
: P2 normal
: ---
Assigned To: Travis Leithead [MSFT]
HTML WG Bugzilla archive list
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-08-13 06:03 UTC by Masayuki Nakano
Modified: 2013-08-20 17:04 UTC (History)
9 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Masayuki Nakano 2012-08-13 06:03:24 UTC
http://dev.w3.org/html5/spec/webappapis.html#event-handler-attributes

mousewheel event isn't a standard event. Instead of it, D3E spec defined wheel event which is really different from mousewheel event.
http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html#event-type-wheel

Therefore, I think that only onwheel attribute should be defined by HTML5.
Comment 1 Henri Sivonen 2012-08-13 07:29:49 UTC
If onmousewheel is used in the wild, bikeshedding the name isn't worth the trouble. Is it used in the wild?
Comment 2 Philip Jägenstedt 2012-08-13 08:16:53 UTC
http://software.hixie.ch/utilities/js/live-dom-viewer/saved/1696

This test shows that Opera and Chrome support only the mousewheel event, not the mouse event. Firefox seems to support neither and I'm not able to test in IE, but juding by http://www.quirksmode.org/dom/events/scroll.html it is supported.
Comment 3 Masayuki Nakano 2012-08-13 08:27:01 UTC
FYI: Firefox has supported D3E wheel event since yesterday, but still not support mousewheel event because it's not in any standard spec.
https://bugzilla.mozilla.org/show_bug.cgi?id=719320
Comment 4 Simon Pieters 2012-08-14 15:19:38 UTC
(In reply to comment #1)
> If onmousewheel is used in the wild, bikeshedding the name isn't worth the
> trouble. Is it used in the wild?

Yes.

$ grep -aPic "\sonmousewheel\s*=" web200904 
1434
Comment 5 Robin Berjon 2012-09-11 13:39:42 UTC
EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are
satisfied with this response, please change the state of this bug to CLOSED. If
you have additional information and would like the Editor to reconsider, please
reopen this bug. If you would like to escalate the issue to the full HTML
Working Group, please add the TrackerRequest keyword to this bug, and suggest
title and text for the Tracker Issue; or you may create a Tracker Issue
yourself, if you are able to do so. For more details, see this document:

   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Rejected
Rationale: I concur with Henri, this is used in the wild.
Comment 6 Masayuki Nakano 2012-09-12 03:54:41 UTC
I don't think that onmousewheel is used for D3E WheelEvent. It's used for the legacy mousewheel event on IE, Opera and WebKit browsers. Only IE9 and Fx17 implemented the D3E WheelEvent. Therefore, I don't think the change breaks existing web pages. "onmousewheel" should be available for the legacy (unstandardized) event handler actually, but I think that HTML5 spec shouldn't define such event handler attribute.
Comment 7 Masayuki Nakano 2012-09-12 04:06:15 UTC
FYI:

mousewheel event:
https://developer.mozilla.org/en-US/docs/DOM/DOM_event_reference/mousewheel

MouseWheelEvent object:
https://developer.mozilla.org/en-US/docs/DOM/MouseWheelEvent

So, it's really different event from D3E wheel event (WheelEvent object).
Comment 8 Robin Berjon 2012-09-13 14:26:23 UTC
(In reply to comment #6)
> I don't think that onmousewheel is used for D3E WheelEvent. It's used for the
> legacy mousewheel event on IE, Opera and WebKit browsers. Only IE9 and Fx17
> implemented the D3E WheelEvent. Therefore, I don't think the change breaks
> existing web pages. "onmousewheel" should be available for the legacy
> (unstandardized) event handler actually, but I think that HTML5 spec shouldn't
> define such event handler attribute.

Sorry but I'm not entirely certain that I understand what changes you would like to see. Here is what I understand, please tell me if I get it right.

You would like the HTML spec to drop onmousewheel. Reason: At least Firefox doesn't support it and doesn't plan to (according to https://developer.mozilla.org/en-US/docs/DOM/DOM_event_reference/mousewheel). If that's indeed the case, it seems like a good reason to drop it (requires confirmation though).

Furthermore, you are asking that HTML define the "onwheel" attribute. Am I correctly guessing that by that you mean just the on* attribute but for what it actually does refer to D3E?
Comment 9 Masayuki Nakano 2012-09-14 01:15:51 UTC
(In reply to comment #8)
> You would like the HTML spec to drop onmousewheel. Reason: At least Firefox
> doesn't support it and doesn't plan to (according to
> https://developer.mozilla.org/en-US/docs/DOM/DOM_event_reference/mousewheel).
> If that's indeed the case, it seems like a good reason to drop it (requires
> confirmation though).

Yes, but the reason isn't the firefox's plan. The mousehweel event has never defined yet. That's the reason why firefox doesn't have plan to implement it (Actually, the behavior of IE, WebKit and Opera isn't same even on Windows though). I think that HTML5 spec shouldn't define on* attributes whose event isn't defined in any standard spec.

> Furthermore, you are asking that HTML define the "onwheel" attribute.

Yes.

> Am I
> correctly guessing that by that you mean just the on* attribute but for what it
> actually does refer to D3E?

Sorry, I'm not sure what you ask me here. I just reported only for "onwheel". But it may be better if HTML5 defines on* attributes for all D3E events (e.g., "focusin", "focusout", "mouseenter", "mouseleave", "compositionstart", "compositionupdate", "compositionend", but I'm not sure for deprecated DOM* events in D3E).
Comment 10 Henri Sivonen 2012-09-17 12:07:53 UTC
Shouldn't it be considered a defect of DOM3 Events if it reinvents the wheel and mints a new event name instead of standardizing what most browsers implement?
Comment 11 Masayuki Nakano 2012-09-18 03:51:00 UTC
(In reply to comment #10)
> Shouldn't it be considered a defect of DOM3 Events if it reinvents the wheel
> and mints a new event name instead of standardizing what most browsers
> implement?

I don't think so. The mousewheel event isn't useful for web developers since the delta values don't indicate preferred scroll amount. On the other hand, legacy mouse wheel events on Gecko indicate the scroll amount but the behavior is too complicated.

The new D3E wheel event indicates the scroll amount and behaves simply. So, I believe that the D3E wheel event improves everything for mouse wheel event handling on web applications.
Comment 12 Masayuki Nakano 2013-07-22 08:40:40 UTC
I sorted out and documented the legacy mousewheel event's delta value between IE, Opera(Presto), Chrome and Safari. See the chaos of this event. HTML5 shouldn't refer this event. Instead of that, referring D3E wheel event is good solution.

https://developer.mozilla.org/en-US/docs/DOM/DOM_event_reference/mousewheel#wheelDelta.2C_wheelDeltaX_and_wheelDeltaY_value

So, I strongly recommend that HTML5 spec should drop onmousewheel attribute and add onwheel attribute.
Comment 13 Michał Z. Gołębiowski 2013-08-20 13:00:40 UTC
This is a huge problem. IE9+ implements the `wheel` event but not the `onwheel` attrubute. This makes it impossible for web developers to feature detect the event presence and forcing them to create ugly UA-sniffs, see:
https://github.com/mzgol/wheel/blob/master/jquery.wheel.js#L17-19
and:
https://github.com/brandonaaron/jquery-mousewheel/blob/master/jquery.mousewheel.js#L27

I reported the issue to the IE team:
http://connect.microsoft.com/IE/feedback/details/782835
but they advised to use the flawed `hasFeature` method that isn't even supported any more by Firefox:
https://bugzilla.mozilla.org/show_bug.cgi?id=801425
This is because feature detection methods based on "I'll tell you if I think I support a particular spec" doesn't work.

Checking for the `on`+event attributes is the most reliable way of feature detecting support for it. If it was specified, I'd have it easier to press IE team to implement it.
Comment 14 Michał Z. Gołębiowski 2013-08-20 13:02:12 UTC
WebKit now also always returns true for hasFeature:
http://trac.webkit.org/changeset/153901
Comment 15 Travis Leithead [MSFT] 2013-08-20 16:48:50 UTC
(In reply to comment #13)
> Checking for the `on`+event attributes is the most reliable way of feature
> detecting support for it. If it was specified, I'd have it easier to press
> IE team to implement it.

No need to press, it's on our radar--just didn't land in time for IE11.
Comment 16 Michał Z. Gołębiowski 2013-08-20 17:00:41 UTC
(In reply to comment #15)
> (In reply to comment #13)
> > Checking for the `on`+event attributes is the most reliable way of feature
> > detecting support for it. If it was specified, I'd have it easier to press
> > IE team to implement it.
> 
> No need to press, it's on our radar--just didn't land in time for IE11.

Good to know, when I reported the issue:
http://connect.microsoft.com/IE/feedback/details/782835/
I got a negative answer: that I can use `hasFeature` (which is broken by design).

Too bad you don't plan to make it for IE11, in my `wheel` jQuery plugin I'm first checking for `onwheel` and when missing, I'm doing an ugly UA-sniff by checking `navigator.appName`. The code will now break in IE11 since it changed the `appName` value without matching behavior of other browsers with respect to `onwheel`.
Comment 17 Masayuki Nakano 2013-08-20 17:04:14 UTC
Although the reason why web developers want onwheel attribute for the feature detection is, WebKit and Blink returns non-null for window.WheelEvent even they don't support D3E WheelEvent...