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

@mbrodesser commented on this pull request.



> +
+   1. For each |representation| in |itemTypeList|:
+
+    1. If |representation|'s [=representation/MIME type=] is |mimeType|, then:
+
+     1. Let |p1| be the |representation|'s [=representation/data=].
+
+      1. [=promise/React=] to |p1|:
+
+       1. If |p1| was fulfilled with value |v|, then:
+
+        1. If |v| is a {{DOMString}}, then follow the below steps:
+
+         1. Let |v1| be the result of [=/encoding=] |v|.
+
+         1. Let |blobData| be a [=Blob=] created using |v1| with its {{Blob/type}} set to |mimeType|, [=serialize a MIME type|serialized=].

> Invoking constructors from specs is a bad idea since it will break if someone does `window.Blob = 5`. Similarly the not-defined-for-specs object literal notation you are using with `{ type: |serializedMimeType| }` can get messy if someone does `Object.prototype.type = "something"`.
> 

Makes sense. Thanks for the explanation.

> What is needed is for the File API spec to define a "create a Blob given MIME type, line endings mode, and data".

Yes, exactly.

> Given that no such definition exists today we are best off just kind of writing our spec as if it does exist.

Makes sense. We indeed have to limit the scope of this ticket.

-- 
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_r770367216

Received on Thursday, 16 December 2021 09:35:08 UTC