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

@snianu commented on this pull request.



>    };
   </pre>
 
-  <div id="clipboard-idl" dfn-for="Clipboard">
+  The methods of the {{Clipboard}} interface take or return multiple {{ClipboardItem}} objects, and their specification is written to deal with the generic case. 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.

> isn't entirely true, please see #158 (comment).

In `write()`, the algorithm has a step to deal with multiple `clipboard item`s: 
`1. If |data|'s [=list/size=] is greater than 1, and the current operating system does not support multiple [=/clipboard item=]s on the [=system clipboard data=], then set |data| to |data|[0].`

FWIW, we've been discussing this internally whether we will ever support this use case or not, and we came to a conclusion that since this is very specific to a particular platform (macOS, iPadOS etc) we probably won't implement this in the near future. So, to limit the scope of this PR, I'll add text to just return the first `clipboard item` in `readText()` if the platform doesn't support it. 

However, I'll let Apple devs clarify this algorithm in a separate PR if they want to add some texts to these methods, since they are the only ones who know how multiple `clipboard item`s would behave in these methods.

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

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

Received on Wednesday, 19 January 2022 01:36:09 UTC