W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2011

Re: clipboard events spec and HTML5 spec - divide and conquer, but where?

From: Ian Hickson <ian@hixie.ch>
Date: Fri, 7 Jan 2011 20:02:02 +0000 (UTC)
To: "Hallvord R. M. Steen" <hallvord@opera.com>
cc: public-webapps@w3.org
Message-ID: <Pine.LNX.4.64.1101071950440.28618@ps20323.dreamhostps.com>
On Fri, 7 Jan 2011, Hallvord R. M. Steen wrote:
> On Fri, 07 Jan 2011 04:31:01 +0900, Ian Hickson <ian@hixie.ch> wrote:
> > On Thu, 6 Jan 2011, Hallvord R. M. Steen wrote:
> > > 
> > > I've done some work on a spec for clipboard events, initially just 
> > > to make up my mind about what Opera needs to implement, but as it 
> > > might be a useful thing in general I've volunteered to edit it as a 
> > > WebApps WG delivery. It will be a fairly small spec, only handling 
> > > clipboard events.
> > 
> > Is it intended to also cover cut, copy and paste?
> 
> Sorry, I don't understand the question.

Well, for example, the 'cut' operation involves removing or mutating DOM 
nodes (for contentEditable) or editing the control value (for <input>) or 
raw value (for <textarea>), and modifying the selection accordingly. 
Similarly, 'paste', e.g. for <input>, involves changing the <input> value, 
firing 'input' events, modifying the selection, etc.


> > The current spec draft seems very vague about when the events fire and 
> > what their default actions are, but I can't tell if that's intentional 
> > or not.
> 
> No vagueness is intended.
> 
> Could you give me two examples of things that needs to be more specific, 
> one regarding timing and one regarding default action?

Sure. For example, when should the paste event fire relative to when 
keydown/keyup events fire? When should the paste event fire relative to 
when the 'input' event fires? Should it fire asynchronously as a separate 
task; should it fire as part of the default action of the keypress event 
synchronously? Where do these events fire relative to mutation events, for 
contentEditable? What should the default action of 'paste' be, in terms of 
DOM mutations when the cursor is in a contentEditable section? How should 
DataTransfer be set up when the data comes from a non-Web source?

Another example, more editorial, is that the spec currently doesn't have a 
conformance section and doesn't define how to determine what the normative 
conformance requirements are. Assuming RFC2119 semantics, the spec is 
lacking detail. For example, nothing normatively says whether the events 
bubble or not, it's just left up to the reader to assume that the table 
implies that it does. There's also no normative requirement linking the 
description of what the target is to the actual firing of the event.

For some background, see:

   http://ln.hixie.ch/?start=1140242962&count=1

When the spec says "A must do B. B's C is D.", the second sentence is not 
normative, it's just descriptive -- describing what another part of the 
specification presumably requires. I assume you intend something more like 
"A must do B, with B set up as follows: B's C must be D." or some such.


> > > Now, this needs a bit of syncing with HTML5 because right now that 
> > > spec defines a ClipboardEvent interface that contains some of the 
> > > stuff in HTML5's DataTransfer interface. To avoid this overlap I 
> > > guess there are two ways forward, either I remove those bits from 
> > > the clipboard events spec and reference HTML5, or you remove them 
> > > from HTML5 and say that DataTransfer extends ClipboardEvent. I'm 
> > > happy either way (though if I'm going to reference DataTransfer I'll 
> > > call out explicitly what methods are required for clipboard events 
> > > and omit the DnD specific stuff). Which approach do you think would 
> > > be better?
> > 
> > What do browsers do? Do they use the same object, including the 
> > drag-and-drop specific attributes, or is it a different interface?
> 
> In WebKit, event.clipboardData in copy/cut/paste events and 
> event.dataTransfer in drag/drop events both implement a "Clipboard" 
> interface, so the same attributes are available.

In that case we should probably just use the same interface, and put 
copy/paste and drag/drop in the same spec. If they're in separate specs, 
it's probably simplest if the DataTransfer stuff is with the DND stuff, 
since that's the main driver for changes to the DataTransfer interface. 
I'm happy to work with you to make sure the DataTransfer spec still works 
for copy/paste.

Conceptually, copy/paste and drag-and-drop can be viewed as the same thing 
(indeed, an older version of the HTML spec actually defined copy/paste in 
terms of DND), so this should be relatively simple.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Friday, 7 January 2011 20:02:33 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:42 GMT