Re: [Clipboard] Processing model feedback (and other)

On Thu, Feb 9, 2012 at 7:20 AM, Hallvord R. M. Steen <hallvord@opera.com>wrote:

> * The "Process the default action" step should instead talk about whether
>> or not the http://dvcs.w3.org/hg/domcore/**raw-file/tip/Overview.html#**
>> canceled-flag<http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#canceled-flag>of the event ended up being set and what to do when it is not.
>>
>
> Seems pretty readable and precise to me as-is.


It's not clear to me.  It makes it sound like you always perform the stuff
in step 8, since there's no conditional.  I have to guess what's actually
intended.

There's an awkwardness to the steps in section 5.  Based on the style I'm
used to seeing in other modern Web specs, I'd write it along these lines
(note that HTML formatting is used below):

To *fire a clipboard event named e*,

1. Let *data transfer* be a DataTransfer object.
2. Let *clear was called *be true.
3. Let *types to clear* be an empty unordered set.
4. Let *sequence number* be the sequence number of the clipboard content,
or null if not supported.
5. If the context is editable, let *event target* be the element that
contains the start of the selection in document order, or the BODY element
if there is no selection or cursor.  If the context is not editable, let *event
target* be the focused node, or BODY if no node has focus.
6. If *e* is:
    *paste*:
        ....
    *copy* or *cut*:
        ...
7. Dispatch an event using the *ClipboardEvent* interface, with its
*type* attribute
initialized to *e*, its *isTrusted* attribute initialized to true, and its *
clipboardData* attribute initialized to *data transfer*, at *event target*.
8. If the event's *canceled flag* is not set, then if *e* is:
    *paste*:
        ....

Then, elsewhere, say eg. "*fire a clipboard event named paste*".

Step 4 has an "i.e."; if you feel something needs additional explanation,
it probably belongs in a note.  The bits about "the focused node" and "the
context is editable" above should probably reference something specific in
HTML.

Step 5 switched from a procedural style to a descriptive style.  (That is,
instead of saying "do this, then do this", it started to say "this must be
like this, and this must be like this".)  When describing an algorithm, it
helps to stay procedural the whole way through.

Section 6 says "The default action of a synthetic paste event".  There is
no "default action" for events fired by scripts (except for one or two
unfortunate backwards-compatibility hacks).  The default action of an event
fired by script is whatever the JavaScript programmer does if
dispatchEvent() returns false; dispatching an event has no side-effects
except firing event listeners.  Please see
http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-eventtarget-dispatchevent
for
the modern definition of dispatchEvent.

-- 
Glenn Maynard

Received on Thursday, 16 February 2012 16:05:56 UTC