Skip to content

Questions about implementing clipboard.write #237

@trflynn89

Description

@trflynn89

In the following steps, iterating over itemList:

https://un5gnp8dyv5rcyxcrjjbfp0.julianrbryant.com/clipboard-apis/#dom-clipboard-write

4. For each clipboardItem in dataList:
    1. For each representation in clipboardItem’s clipboard item's list of representations:
        (in this loop, we add items to `itemList`
    2. For each blob in itemList:
        5. Append cleanItem to cleanItemList.
    3. Let option be clipboardItem’s clipboard item's presentation style.
    4. Write blobs and option to the clipboard with cleanItemList and option.

After we writecleanItemList to the clipboard, we do not clear itemList over clearItemList. So on the next iteration of dataList, won't we write those same items again? These lists will just keep growing as we loop over dataList.


In the same steps, the spec seems to assume that the "2. React to representationDataPromise:" step will react synchronously. In practice, this occurs asynchronously, because even when the promise is already resolved, the reaction steps ultimately queue a microtask to run the fulfillment/rejection steps (via HostEnqueuePromiseJob).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions