[w3c/clipboard-apis] Defer OS clipboard read from clipboard.read() to ClipboardItem.getType() (PR #248)

Spec change to defer OS clipboard reads from `clipboard.read()` to
  `ClipboardItem.getType()`.

  Previously, `clipboard.read()` eagerly fetched all clipboard payload bytes from
  the OS at call time. This change specifies that `clipboard.read()` enumerates
  only the available format names (metadata), and the actual OS data read is
  deferred to when the author calls `getType()` on the resulting `ClipboardItem`.

  Specific changes:
  - `clipboard.read()`: initializes each representation's data to a new unresolved
    promise instead of eagerly resolving it with OS clipboard bytes. Resolves the
    existing Issue: "It should be possible to read the data asynchronously from
    the system clipboard after the author calls getType".
  - `ClipboardItem.getType()`: adds a deferred OS read block that runs in parallel,
    reads bytes via the `os specific well-known format` algorithm, applies
    sanitization (same rules as before), and queues resolution on the clipboard
    task source per Infra conventions.


<!--
    This comment and the below content is programmatically generated.
    You may add a comma-separated list of anchors you'd like a
    direct link to below (e.g. #idl-serializers, #idl-sequence):

    Don't remove this comment or modify anything below this line.
    If you don't want a preview generated for this pull request,
    just replace the whole of this comment's content by "no preview"
    and remove what's below.
-->
***
<a href="https://pr-preview.s3.amazonaws.com/shwetabin/clipboard-apis/pull/248.html" title="Last updated on Mar 26, 2026, 3:24 PM UTC (6d51b0a)">Preview</a> | <a href="https://pr-preview.s3.amazonaws.com/w3c/clipboard-apis/248/ab5f530...shwetabin:6d51b0a.html" title="Last updated on Mar 26, 2026, 3:24 PM UTC (6d51b0a)">Diff</a>
You can view, comment on, or merge this pull request online at:

  https://github.com/w3c/clipboard-apis/pull/248?email_source=notifications&email_token=ACLYVMIRQC3PRBE5NFYYDVL4SVD3DA5CNFSNUABEM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UF4ZTINJSGE3DGNZZHGTHEZLBONXW5KTTOVRHGY3SNFRGKZFFMV3GK3TUVVYHEX3POBSW4X3DNRUWG2Y

-- Commit Summary --

  * Defer OS clipboard read from clipboard.read() to ClipboardItem.getType()

-- File Changes --

    M index.bs (58)

-- Patch Links --

https://github.com/w3c/clipboard-apis/pull/248.patch?email_source=notifications&email_token=ACLYVMPJFW6T6BYVOEEI37T4SVD3DA5CNFSNUABEM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UF4ZTINJSGE3DGNZZHGTHEZLBONXW5KTTOVRHGY3SNFRGKZFFMV3GK3TUVZYHEX3QMF2GG2C7MNWGSY3Lhttps://github.com/w3c/clipboard-apis/pull/248.diff?email_source=notifications&email_token=ACLYVMN23A7LFFYRDJKHBHL4SVD3DA5CNFSNUABEM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UF4ZTINJSGE3DGNZZHGTHEZLBONXW5KTTOVRHGY3SNFRGKZFFMV3GK3TUVVYHEX3ENFTGMX3DNRUWG2Y
-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/clipboard-apis/pull/248
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/clipboard-apis/pull/248@github.com>

Received on Thursday, 26 March 2026 15:26:45 UTC