Re: Please Review: Mousewheel Event Proposal

Bjoern Hoehrmann wrote:
> * Olli Pettay wrote:
>> "For both mouseomniwheel and mousewheel,
>> MouseEvent.relatedNode must indicate the element over which the
>> pointer is located"
>> Why? element.target should indicate that already.
>
> Because that may not be the case. Consider for example a select box with
> multiple options: if the box is the active element, rotating the wheel
> changes the selection,
I which browser? Not in any browsers I tested. Selection stays the same.

  independently of whether the mouse cursor points
> at the box; in this case .target could be the select box and relatedNode
> the element under the cursor.

it would be useful to get the target for the possible scroll somehow,
so perhaps if something will be scrolled (if default action won't be
canceled), the scrolled element could be .relatedTarget.

Currently browsers seem to use quite different targets for their
mousewheel/DOMMouseScroll events.

IE7's srcElement is the element under the mouse except if mouse is for
example over <select>, in which case srcElement is <select>, not
<option>. Scrolling an opened <select size="1"> does dispatch the event
to <select>.

In Opera9.5 the target is the element under mouse, except if mouse is 
over the scrollbar of <select size>1>, in that case the target is 
<option>, not the <select> to which the scrollbar, IMO, belongs to.
If mouse wheel is used to scroll an opened <select size="1">, the event
isn't dispatched.

Safari3.1 targets <select size>1>, not <option>, when scrolling it.
Scrolling an opened <select size="1"> doesn't seem to generate events.
Otherwise the target is whatever *node* is under the mouse. So also
a textnode can be the target.

Firefox3 has always the element under mouse as the target, also when 
scrolling an opened <select size="1"> - so the target in that case is
<option>. And if mouse is over the scrollbar of a <select>, then the 
<select> is the target, not <option>.

Scrolling closed <select size="1"> is in every browser targeted to <select>

-Olli

Received on Friday, 28 March 2008 20:11:11 UTC