Fwd: some questions regarding clipboard event / clipboard data API

(Some questions - especially for WebKit developers I guess. I don't  
think this group is currently working on clipboard events but somebody  
should be ;). I tried sending to the WHATWG list first but for  
whatever reason several attempts have not gone through - no idea if  
the culprit is GMail, Opera or whatwg.org's mailman. Hope it's not  
considered off-topic here!)


I'm trying to put together a small spec and a test suite for the
clipboard data API which originates from Internet Explorer and is
supported by WebKit as event.clipboardData in copy/cut/paste events.

I have a few questions regarding the way the API is implemented at the moment.

1) In paste events, WebKit often points event.target to a text node.
As far as I know, you've had (or have) known bugs where events target
text nodes when they should target elements. I think no events
otherwise target text nodes. Do you consider the current
implementation a bug, or do you intend to keep it?

2) WebKit defines event.types but I've never seen it be anything but
null. Since it exists (but isn't fully implemented?) and I don't know
where this property came from or what the plans are, I've just
suggested the following text:

The types property returns a DOMStringList of MIME type strings.
[RFC2046]. In the paste event, it lists those formats available on the
clipboard the implementation supports returning to the script. In the
copy and cut events, the types property returns a list of supported
formats for the copy operation - for example, if the implementation
supports copying plain text and HTML it would return a DOMStringList
with the values 'text/plain' and 'text/html'.

If you have implemented or plan to implement something else please let
me know :)

[Note: I've since discovered HTML5's DataTransfer object spec, so I  
understand what .types do in drag-and-drop contexts. Is it a good idea  
to re-use it as described above for cut/copy/paste events, or should  
we just leave it set to null? ]

3) The clipboardData.setData() method's spec is based on what IE does,
since the method never appeared to do anything in my WebKit testing.
If there is a secret preference to toggle or something, please let me
know.

4) Although both IE and WebKit support before* events (beforecut,
beforecopy, beforepaste) I've omitted them because I can't see the use
case for these events. What distinguishes a before* event from a
regular cut/copy/paste event? Why is it useful to have both? Are you
aware of legacy content that requires before* events?

I will probably share the draft spec and tests when it is developed a
bit further, for now thanks for any light anybody can shed on these
questions.

-- 
Hallvord R. M. Steen

Received on Friday, 17 September 2010 12:47:35 UTC