[whatwg] Drag-and-drop feedback

David Flanagan david at davidflanagan.com
Mon Jan 31 15:36:35 PST 2011


Ian,

I love the new dropzone attribute.  Nice work.  Here is one nit, and a 
couple of questions

nit: One of your old examples near the beginning of the DnD section 
involves class="dragzone", which seems confusing now that you've added 
an attribute with the same zone.  Maybe change that class to droppable?

Q1) Say I want to create a library to emulate dropzone today, because it 
is just so much nicer than all the dragenter and dragleave stuff.  In 
order to do this right, I need to be able to tell if the browser already 
supports dropzone. Will it work to test ("dropzone" in 
document.createElement('div'))?

I see the spec says:

> The dropzone attribute must reflect the content attribute of the same name.

But I'm not certain that that means a property must exist if the 
attribute does not.

Q2) If I understand correctly, the dropzone attribute means that we no 
longer *have* to write dragenter and dragleave handlers.  But every 
useful dropzone I've seen in practice provides some kind of feedback 
(changes background color, e.g.) when it is "armed" and ready to accept 
a drop.  Is there any mechanism for doing this?  If not, then that 
really diminishes the value of dropzone.  I can't see how I'd write 
dragenter and dragleave handlers to change the background color of the 
element and also rely on the dropzone attribute, since it seems to be 
processed after dragenter/leave are triggered...

One approach would be to define dropzone_activate and 
dropzone_deactivate events to handle this case.  A better solution might 
be to define a :dropzone-active CSS pseudo class, if you can coordinate 
that with the CSS folks...

	David



More information about the whatwg mailing list