Re: [whatwg] [selectors4] drag-and-drop pseudo-classes

On Tue, Aug 14, 2012 at 12:13 PM, Ryosuke Niwa <rniwa@webkit.org> wrote:
> I'm asking how we're supposed to implement this pseudo-classes given that
> the only way to know whether an element can receive the item is by firing
> dragenter and/or dragover events. e.g.

No, we can know it declaratively via the dropzone attribute.  That's
what these will key off of in HTML.  In @dropzone, you can declare the
types of data that it will accept, and you know the type of the data
as soon as the drag starts, so you have all the info you need.

We obviously can't address "dropzones" that are only detectable during
the dragover event.  That's fine - they just won't respond to these
pseudo-classes.  Consider it an inducement to use the new, better
model that @dropzone allows.


>> As well, the pseudo that matches "the drop target that will be used if
>> you dropped right now" might not be expressible in pure CSS even given
>> the above.  It's probably equivalent to "when you :hover it", but
>> there are applications that basically have this functionality that
>> work differently - for example, I think that the built-in Windows
>> solitaire game highlight the closest drop target to the current mouse
>> pointer, even if you're nowhere near the actual drop zone.
>
> Yeah, and that's not compatible with how drag and drop are implemented on
> the Web.

I know.  You'll notice that I didn't suggest we somehow change to
that.  ^_^  However, other languages might want this kind of model,
and we could in the future add a switch to allow this kind of behavior
in HTML. My point is just that, even if you solve the other problems,
you still might not be able to implement that pseudoclass in existing
CSS.

~TJ

Received on Tuesday, 14 August 2012 19:54:41 UTC