- From: mbrodesser <notifications@github.com>
- Date: Wed, 15 Dec 2021 02:01:55 -0800
- To: w3c/clipboard-apis <clipboard-apis@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3c/clipboard-apis/pull/158/review/832589685@github.com>
@mbrodesser commented on this pull request.
> + 1. Let |clipboardItemObject| be a [=new=] {{ClipboardItem}} with |realm|.
+
+ 1. Set |clipboardItemObject|'s [=clipboard item=] to |clipboardItem|.
+
+ The <dfn constructor for="ClipboardItem" lt="ClipboardItem(items, options)"><code>new ClipboardItem(<var>items</var>, <var>options</var>)</code></dfn> constructor steps are:
+ 1. Set [=this=]'s [=ClipboardItem/clipboardItem=] to a new [=clipboard item=].
+
+ 1. Set [=this=]'s [=ClipboardItem/clipboardItem=]'s [=presentation style=] to |options|["{{ClipboardItemOptions/presentationStyle}}"].
+
+ 1. Let |types| be a list of {{DOMString}}.
+
+ 1. For each (|key|, |value|) in |items|:
+
+ 1. Let |mimeType| be the result of [=parsing a MIME type=] given |key|.
+
+ 1. If |mimeType| is failure, then throw a {{TypeError}}.
> That's a good thing to spot. So to be clear, you are suggesting that if you include two duplicates, the implementation must throw: e.g., `{ "text/html": x, "TEXT/HTML": y }.`
Yes, that's the idea. Passing such arguments is presumably always unintended, hence it would simplify web-developers' lives.
> If you did want to go for throwing,
It seems desirable.
> I would suggest not doing the `|listOfRepresentations|` alias, but instead just inserting `If [=this=]'s [=ClipboardItem/clipboard item=]'s [=list of representations=] [=list/contains=] |mimeType|, then throw a {{TypeError}}.`
It's understandable, but less precise, because it doesn't mention `representation`'s `type`. Was that intended? I agree that the for loop is verbose.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/clipboard-apis/pull/158#discussion_r769464688
Received on Wednesday, 15 December 2021 10:02:08 UTC