W3C home > Mailing lists > Public > www-dom@w3.org > October to December 2010

Re: scroll event's target

From: Olli Pettay <Olli.Pettay@helsinki.fi>
Date: Sat, 30 Oct 2010 21:11:43 +0300
Message-ID: <4CCC5FDF.7020903@helsinki.fi>
To: Anne van Kesteren <annevk@opera.com>
CC: "www-dom@w3.org" <www-dom@w3.org>, Jacob Rossi <jrossi@microsoft.com>
On 10/30/2010 01:32 PM, Anne van Kesteren wrote:
> On Sat, 30 Oct 2010 00:02:06 +0200, Jacob Rossi <jrossi@microsoft.com>
> wrote:
>> The spec is unclear to me as to what the target should be for scroll
>> events that result from the window being scrolled. It seems to me that
>> we should fire the event on the default view (window). However,
>> implementations seem to disagree.
>>
>> The spec says "A user agent must dispatch this event when a document
>> view or an element has been scrolled."
>>
>> Shouldn't "document view" be "default view?" And in that case, then,
>> shouldn't the target be the default View (window)?
>>
>> Test case:
>> window.onload = function(){
>> document.body.style.height = '10000px'
>> window.addEventListener('scroll', function (e) { alert((e.target ==
>> window && e.eventPhase == Event.AT_TARGET) ? 'passed' : 'failed'); },
>> true)
>> window.scrollTo(0, 1)
>> };
>
> AFAIK when the document viewport is scrolled the event is dispatched on
> Document and bubbles up to Window. I do not think we can change that now.

Yeah, this is one unfortunate case. Normally scroll event doesn't
bubble, but the one dispatched by the browser to the document
does bubble.


-Olli


>
>
Received on Saturday, 30 October 2010 18:12:27 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:14:06 GMT