Skip to content

Commit

Permalink
[Async Clipboard API] Add supports method to async clipboard API.
Browse files Browse the repository at this point in the history
In this change we are adding a new static method `supports` to the
ClipboardItem interface to help web authors detect clipboard format
types that are supported by Chromium.
Github Issue: w3c/clipboard-apis#170
Spec: w3c/clipboard-apis#192

Bug: 1483026
Change-Id: Ief7c0786833548d2fb51215cefbc39e5930af875
  • Loading branch information
snianu authored and chromium-wpt-export-bot committed Sep 15, 2023
1 parent 42bf85b commit 44dde2c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions clipboard-apis/clipboard-item.https.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,13 @@
const text = await (new Response(blob)).text();
assert_equals(text, 'xxx');
}, "getType(DOMString invalid type) converts DOMString to Blob");

promise_test(async () => {
assert_true(ClipboardItem.supports('text/plain'));
assert_true(ClipboardItem.supports('text/html'));
assert_true(ClipboardItem.supports('image/png'));
assert_true(ClipboardItem.supports('web '));
assert_false(ClipboardItem.supports('image/svg+xml'));
assert_false(ClipboardItem.supports('not a/real type'));
}, "supports(DOMString) returns true for types that are supported, false otherwise");
</script>

0 comments on commit 44dde2c

Please sign in to comment.