[w3c/clipboard-apis] Should the constructor of ClipboardItem accept a record<DOMString, ClipboardItemDataType>? (#102)

Currently, the first argument in ClipboardItem’s constructor takes a record of `DOMString` to `ClipboardItemData`, which is a `Promise<ClipboardItemDataType>` where `ClipboardItemDataType` is either a string or a blob.

However, the following code:

```
const item = new ClipboardItem({
    "text/plain" : new Blob(["foo"], { type: "text/plain" })
});
```

works fine in Chrome 77.0.3865.120, whereas:

```
const item = new ClipboardItem({
    "text/plain" : new Promise(r => r(new Blob(["foo"], { type: "text/plain" })))
});
```

results in `TypeError: Failed to construct 'ClipboardItem': Failed to convert value to 'Blob’.`. Should the spec be revised to allow for either `ClipboardItemData` or `ClipboardItemDataType` as record values?

For reference: https://www.w3.org/TR/clipboard-apis/#clipboarditem


-- 
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/issues/102

Received on Thursday, 10 October 2019 20:44:36 UTC