- From: Zgroza (Luke Klimek) <notifications@github.com>
- Date: Mon, 29 Sep 2025 08:07:59 -0700
- To: w3c/clipboard-apis <clipboard-apis@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3c/clipboard-apis/pull/239/review/3280371057@github.com>
@zgroza commented on this pull request. > + 1. Set <var>document</var>'s <dfn for="Document">clipboardchange pending flag</dfn> to true. + + </div> + + <div class="algorithm" data-algorithm="document-focus-steps"> + <h5 id="h-document-focus-steps">Document focus steps</h5> + + When a {{Document}} <var>document</var> gains [=system focus=]: + + 1. If <var>document</var>'s [=Document/clipboardchange pending flag=] is true: + 1. Set <var>document</var>'s [=Document/clipboardchange pending flag=] to false. + 2. Let <var>types</var> be a list of [=mandatory data types=] available on the [=system clipboard=]. + 3. Let <var>changeId</var> be a unique identifier for this clipboard change, generated according to the steps defined in <a href="#h-changeid-generation">ChangeId Generation</a>. + 4. Let <var>eventInit</var> be a new {{ClipboardChangeEventInit}} dictionary with its {{ClipboardChangeEventInit/types}} member set to <var>types</var> and its {{ClipboardChangeEventInit/changeId}} member set to <var>changeId</var>. + 5. Let <var>global</var> be <var>document</var>'s [=relevant global object=]. + 6. [=Fire an event=] named {{GlobalEventHandlers/clipboardchange}} at <var>global</var>, using {{ClipboardChangeEvent}}, with <var>eventInit</var>. A potential performance improvement idea: Can we add here a provision that the user agent MAY skip firing the events which pertain to already old clipboard changes? Meaning the situation where several clipboard changes appear very rapidly and we'd be left with the following sequence: 1. Clipboard changes (1st change) 2. Clipboard rapidly changes again (2nd change) 3. Browser finishes processing the 1st change and fires the event 4. Browser finishes processing the 2nd change and fires the event Then the information received through the event in 3rd step would anyway be useless to the website—and delivering the event (+processing it) requires additional resources. -- Reply to this email directly or view it on GitHub: https://github.com/w3c/clipboard-apis/pull/239#pullrequestreview-3280371057 You are receiving this because you are subscribed to this thread. Message ID: <w3c/clipboard-apis/pull/239/review/3280371057@github.com>
Received on Monday, 29 September 2025 15:08:03 UTC