Re: [w3c/clipboard-apis] Add clipboard IDL description. (#158)

@mbrodesser requested changes on this pull request.

@snianu 

I agree that this PR clearly improves the state of the spec. Thanks for all the work so far.

Moreover, there's precedent that other, valuable, but significantly smaller PRs have been stuck (e.g. https://github.com/w3c/clipboard-apis/pull/127). Therefore, it seems reasonable to merge this PR if its content is without contradictions and all remaining open issues have been identified and clearly marked as such.

When the changes requested from this review iteration are incorporated, I'd approve this PR. The identified, remaining issues can then be dealt with separately.

@domenic: since you significantly contributed to this PR, your additional feedback would be appreciated.

>  
-    1. If |r| is not "granted", then reject |p| with a "NotAllowedError" DOMException
+    1. Let |data| be a copy of the [=system clipboard data=] represented as [=clipboard items=]. For the MIME types defined in the [=mandatory data types=] list, |data| contains the sanitized copy of text/html format, but image/png format has unsanitized payload to preserve meta data.

Please add
```
Issue: definition of "sanitized copy" is missing.
```

> +     Note: Clipboard permission is not supported on Safari. However, the readText() method must be called inside
+     a user gesture event and the user must select the paste option from the native context menu that pops up
+     when readText() is called from JS, otherwise, the promise will be rejected.

That note can be deleted. "check clipboard read permission" covers Safari's behavior.

>  
-    1. If |data| contains a "text/plain" item |textItem|, then:
+    1. Let |data| be a copy of the [=system clipboard data=] represented as [=clipboard items=]. For the MIME types defined in the [=mandatory data types=] list, |data| contains the sanitized copy of text/plain format.

Please add:
```
Issue: add definition of "sanitized copy".
```

>    };
   </pre>
 
-  <div id="clipboard-idl" dfn-for="Clipboard">
+  Some methods of the {{Clipboard}} interface take or return multiple {{ClipboardItem}} objects. However, not all platforms support more than one [=/clipboard item=]; on such platforms, the algorithms below will ignore any {{ClipboardItem}} objects beyond the first one that are passed to {{Clipboard/write()}}, and {{Clipboard/read()}} and {{Clipboard/readText()}} will only ever return a single-item array.

Please change
```
beyond the last one
```
to
```
beyond the last one
```
That matches what currently is specified for `write()`. For `read()`, when the platform supports only one clipboard item, the last item is the first item.

>  
    1. Run the following steps [=in parallel=]:
 
-    1. Let |r| be the result of running [=check clipboard read permission=] [=in parallel=]
+    1. Let |r| be the result of running [=check clipboard read permission=].
+
+     Note: Clipboard permission is not supported on Safari. However, the read() method must be called inside

That note can be deleted. "check clipboard read permission" covers Safari's behavior.

>  
-   1. Return |p|.
+     1. If |data|'s [=list/size=] is greater than 1, then add |data|[0] to |dataList|.
+
+      Issue: when |data| contains multiple items and the operating system supports multiple native clipboard items, the current algorithm writes the items in sequence to the system clipboard instead of writing them collectively. That is, the last item replaces the previous ones.

That seems to be a copy-paste error. Please change to
```
Issue: reading multiple clipboard items should be fixed in https://github.com/w3c/clipboard-apis/issues/166.
```

> +     Note: Clipboard permission is not supported on Safari. However, the write() method must be called inside
+     a user gesture event and the user must select the paste option from the native context menu that pops up
+     when write() is called from JS, otherwise, the promise will be rejected.

Please change to
```
Issue: clipboard-write was removed in https://github.com/w3c/clipboard-apis/pull/164.
```

>  
    1. Run the following steps [=in parallel=]:
 
-    1. Let |r| be the result of running [=check clipboard write permission=] [=in parallel=]
+    1. Let |r| be the result of running [=check clipboard write permission=].
+
+     Note: Clipboard permission is not supported on Safari. However, the writeText() method must be called inside

Please change to
```
Issue: clipboard-write was removed in https://github.com/w3c/clipboard-apis/pull/164.
```

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/clipboard-apis/pull/158#pullrequestreview-872842880
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/clipboard-apis/pull/158/review/872842880@github.com>

Received on Friday, 4 February 2022 10:06:22 UTC