Re: [w3c/clipboard-apis] Add comprehensive clipboardchange event specification with ClipboardChangeEventInit dictionary (PR #239)

@utpathak commented on this pull request.



> -   {{GlobalEventHandlers/clipboardchange}} event MUST fire when the user agent regains focus.
+   <div class="algorithm" data-algorithm="fire-clipboardchange-event">
+   <h5 id="h-fire-clipboardchange-event">To fire a clipboardchange event</h5>
+
+   To <dfn export>fire a clipboardchange event</dfn> given a {{Document}} <var>document</var>:
+
+   1. If <var>document</var> does not have [=sticky activation=], then return.
+
+   2. Let <var>global</var> be <var>document</var>'s [=relevant global object=].
+
+   3. If <var>document</var> has <a>focus</a>:
+    1. Let <var>types</var> be a [=list=] of [=mandatory data types=] available on the [=system clipboard=].
+    2. Let <var>changeId</var> be a unique identifier for this clipboard change, generated by applying an origin-specific transformation to a system-level clipboard change identifier, ensuring that different origins receive different identifiers for the same clipboard change while maintaining consistency within the same origin.
+    3. 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>.
+    4. [=Fire an event=] named {{GlobalEventHandlers/clipboardchange}} at <var>global</var>, using {{ClipboardChangeEvent}}, with <var>eventInit</var>.
+   4. Otherwise:

Instead of "otherwise", maybe we can use "If document does not have focus". It makes it more readable.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/clipboard-apis/pull/239#pullrequestreview-3135504914
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/clipboard-apis/pull/239/review/3135504914@github.com>

Received on Friday, 22 August 2025 07:21:04 UTC