w3c / clipboard-apis

Clipboard API and events
https://w3c.github.io/clipboard-apis/
Other
143 stars 41 forks source link

`ClipboardItem` constructor should throw when `items` are empty #169

Closed mbrodesser closed 1 year ago

mbrodesser commented 2 years ago
const c = new ClipboardItem([]);

Chrome and Firefox both throw a TypeError. The spec doesn't cover this case.

CC @snianu Keeping this separate from #158 to not widen its scope.

snianu commented 2 years ago

@mbrodesser Ah you are right. It should throw a TypeError. I can add it to the spec if you want, but if this needs further discussion then we can do this in a separate PR.

mbrodesser commented 2 years ago

@snianu let's pull #158 first. This is a minor issue.

EdgarChen commented 1 year ago

Now spec throws TypeError when items is empty after #158, i.e.

The new ClipboardItem(items, options) constructor steps are: If items is empty, then throw a TypeError.

Could we close this?

snianu commented 1 year ago

I think we can close this. Thanks for the reminder!