On Mon, Nov 10, 2008 at 4:41 PM, Chris Prince <[EMAIL PROTECTED]> wrote:
> Is that conventional?  I thought DOM callbacks generally returned
> *true* to indicate "yes, I understood what you wanted and I did
> something".


As discussed in my Big DnD e-mail, of which I've copied the relevant
snippet below. I don't think we came to a conclusion, but it
(returning false to do something) was briefly discussed.

Nigel said:
>> The various callbacks (ondragenter, ondragover, ondragleave, ondrop)
>> should return false if they wish to accept the drag operation. This
>> may seem counter-intuitive to the usual programming convention that a
>> callback returns a boolean indicating success, but this is mimicking
>> the HTML5 idea that an event handler returns false to prevent the
>> default action, which in this case would be to navigate to the given
>> file (and away from the web app that wants the file drop). Note that
>> the JavaScript callback does not have to explicitly call
>> context.event.preventDefault().

And then Aaron said:
> Couple points here:
>
> * Returning false to ondragleave to accept the drag seems weird to me.
> Why would anyone want to wait for ondragleave to accept the drag?
> Similarly, returning false to ondragenter, ondragover, etc seems
> meaningless to me.
>
> * I see nothing weird about returning false to 'accept' the drag. I
> think of it less like 'accepting' (since that is kinda meaningless
> with this API -- there's nothing to accept, you have already gotten
> all the data in ondragdrop) and more like preventing the navigation
> which would normally occur on drop.

Reply via email to