From 0a9fae508ea1dfdaa948f7db9874d57c490340ad Mon Sep 17 00:00:00 2001 From: skyclouds2001 Date: Wed, 13 Dec 2023 13:58:51 +0800 Subject: [PATCH 1/5] add partitioned key --- files/en-us/web/api/cookiechangeevent/changed/index.md | 3 +++ files/en-us/web/api/cookiechangeevent/deleted/index.md | 3 +++ 2 files changed, 6 insertions(+) diff --git a/files/en-us/web/api/cookiechangeevent/changed/index.md b/files/en-us/web/api/cookiechangeevent/changed/index.md index 202125d5725cf3d..f91da9dc9f4c7b5 100644 --- a/files/en-us/web/api/cookiechangeevent/changed/index.md +++ b/files/en-us/web/api/cookiechangeevent/changed/index.md @@ -39,6 +39,9 @@ An array of objects containing the changed cookie(s). Each object contains the f - `"none"` - : Cookies will be sent in all contexts. +- `partitioned` + - : A boolean indicating whether the cookie is a partitioned cookie (`true`) or not (`false`). See [Cookies Having Independent Partitioned State (CHIPS)](/en-US/docs/Web/Privacy/Partitioned_cookies) for more information. + ## Examples In this example when the cookie is set, the event listener logs the `changed` property to the console. The first item in that array contains an object representing the cookie that has just been set. diff --git a/files/en-us/web/api/cookiechangeevent/deleted/index.md b/files/en-us/web/api/cookiechangeevent/deleted/index.md index b129e5d2a90cd5b..0d1867d7170d426 100644 --- a/files/en-us/web/api/cookiechangeevent/deleted/index.md +++ b/files/en-us/web/api/cookiechangeevent/deleted/index.md @@ -39,6 +39,9 @@ An array of objects containing the deleted cookie(s). Each object contains the f - `"none"` - : Cookies will be sent in all contexts. +- `partitioned` + - : A boolean indicating whether the cookie is a partitioned cookie (`true`) or not (`false`). See [Cookies Having Independent Partitioned State (CHIPS)](/en-US/docs/Web/Privacy/Partitioned_cookies) for more information. + ## Examples In this example when the cookie is deleted the event listener logs the first item in the `CookieChangeEvent.deleted` property to the console. It contains an object representing the cookie that has just been deleted. From 1423367701e4e6f204753e577a510c71d68ac0b4 Mon Sep 17 00:00:00 2001 From: skyclouds2001 Date: Wed, 13 Dec 2023 14:00:47 +0800 Subject: [PATCH 2/5] add Optional_Inline mark --- .../web/api/cookiechangeevent/cookiechangeevent/index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/en-us/web/api/cookiechangeevent/cookiechangeevent/index.md b/files/en-us/web/api/cookiechangeevent/cookiechangeevent/index.md index eeb08e89884436b..69102f052b8c698 100644 --- a/files/en-us/web/api/cookiechangeevent/cookiechangeevent/index.md +++ b/files/en-us/web/api/cookiechangeevent/cookiechangeevent/index.md @@ -30,9 +30,9 @@ new CookieChangeEvent(type, options) It is case-sensitive and browsers always set it to `cookiechange`. - `options` {{Optional_Inline}} - : An object that, _in addition of the properties defined in {{domxref("Event/Event", "Event()")}}_, can have the following properties: - - `changed` + - `changed`{{Optional_Inline}} - : An array containing the changed cookies. - - `deleted` + - `deleted`{{Optional_Inline}} - : An array containing the deleted cookies. ### Return value From 8d0178fbe7349b8d8a8be359ea1aeab95ffc337e Mon Sep 17 00:00:00 2001 From: skyclouds2001 Date: Wed, 13 Dec 2023 14:01:54 +0800 Subject: [PATCH 3/5] fix event name --- .../en-us/web/api/cookiechangeevent/cookiechangeevent/index.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/files/en-us/web/api/cookiechangeevent/cookiechangeevent/index.md b/files/en-us/web/api/cookiechangeevent/cookiechangeevent/index.md index 69102f052b8c698..fc5fbeef0e5dc80 100644 --- a/files/en-us/web/api/cookiechangeevent/cookiechangeevent/index.md +++ b/files/en-us/web/api/cookiechangeevent/cookiechangeevent/index.md @@ -26,8 +26,7 @@ new CookieChangeEvent(type, options) ### Parameters - `type` - - : A string with the name of the event. - It is case-sensitive and browsers always set it to `cookiechange`. + - : A string with the name of the event. It is case-sensitive and browsers always set it to `change`. - `options` {{Optional_Inline}} - : An object that, _in addition of the properties defined in {{domxref("Event/Event", "Event()")}}_, can have the following properties: - `changed`{{Optional_Inline}} From 8b37858c07c8beacd3a51b9e9de0d404b9b50de6 Mon Sep 17 00:00:00 2001 From: skyclouds2001 Date: Wed, 13 Dec 2023 14:02:32 +0800 Subject: [PATCH 4/5] add Instance methods section --- files/en-us/web/api/cookiechangeevent/index.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/files/en-us/web/api/cookiechangeevent/index.md b/files/en-us/web/api/cookiechangeevent/index.md index 6f0130249ef9b99..0387e89c560cc8b 100644 --- a/files/en-us/web/api/cookiechangeevent/index.md +++ b/files/en-us/web/api/cookiechangeevent/index.md @@ -35,6 +35,10 @@ _This interface also inherits properties from {{domxref("Event")}}._ - {{domxref("CookieChangeEvent.deleted")}} {{ReadOnlyInline}} {{Experimental_Inline}} - : Returns an array containing one or more deleted cookies. +## Instance methods + +_This interface also inherits methods from {{domxref("Event")}}._ + ## Examples In this example when the cookie is set, the event listener logs the event to the console. This is a `CookieChangeEvent` object with the {{domxref("CookieChangeEvent.changed","changed")}} property containing an object representing the cookie that has just been set. From 5ba4297a6d488d744556c390df70402b3124a2ad Mon Sep 17 00:00:00 2001 From: skyclouds2001 Date: Wed, 13 Dec 2023 15:27:04 +0800 Subject: [PATCH 5/5] update --- files/en-us/web/api/cookiechangeevent/changed/index.md | 4 ++-- .../web/api/cookiechangeevent/cookiechangeevent/index.md | 2 +- files/en-us/web/api/cookiechangeevent/deleted/index.md | 4 ++-- files/en-us/web/api/cookiechangeevent/index.md | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/files/en-us/web/api/cookiechangeevent/changed/index.md b/files/en-us/web/api/cookiechangeevent/changed/index.md index f91da9dc9f4c7b5..efdc6b8bbe87b98 100644 --- a/files/en-us/web/api/cookiechangeevent/changed/index.md +++ b/files/en-us/web/api/cookiechangeevent/changed/index.md @@ -25,7 +25,7 @@ An array of objects containing the changed cookie(s). Each object contains the f - `path` - : A string containing the path of the cookie. - `expires` - - : A timestamp, given as [Unix time](/en-US/docs/Glossary/Unix_time) in milliseconds, containing the expiration date of the cookie. + - : A timestamp, given as {{glossary("Unix time")}} in milliseconds, containing the expiration date of the cookie. - `secure` - : A {{jsxref("boolean")}} indicating whether the cookie is from a site with a secure context (HTTPS rather than HTTP). - `sameSite` @@ -44,7 +44,7 @@ An array of objects containing the changed cookie(s). Each object contains the f ## Examples -In this example when the cookie is set, the event listener logs the `changed` property to the console. The first item in that array contains an object representing the cookie that has just been set. +In this example, when the cookie is set, the event listener logs the `changed` property to the console. The first item in that array contains an object representing the cookie that has just been set. ```js cookieStore.addEventListener("change", (event) => { diff --git a/files/en-us/web/api/cookiechangeevent/cookiechangeevent/index.md b/files/en-us/web/api/cookiechangeevent/cookiechangeevent/index.md index fc5fbeef0e5dc80..a3020344a16e930 100644 --- a/files/en-us/web/api/cookiechangeevent/cookiechangeevent/index.md +++ b/files/en-us/web/api/cookiechangeevent/cookiechangeevent/index.md @@ -11,7 +11,7 @@ browser-compat: api.CookieChangeEvent.CookieChangeEvent {{securecontext_header}}{{APIRef("Cookie Store API")}}{{SeeCompatTable}} The **`CookieChangeEvent()`** constructor creates a new {{domxref("CookieChangeEvent")}} object -which is the event type passed to {{domxref("CookieStore/change_event", "CookieStore.onchange()")}}. +which is the event type of the {{domxref("CookieStore/change_event", "change")}} event fired at a {{domxref("CookieStore")}} when any cookie changes occur. This constructor is called by the browser when a change event occurs. > **Note:** This event constructor is generally not needed for production websites. It's primary use is for tests that require an instance of this event. diff --git a/files/en-us/web/api/cookiechangeevent/deleted/index.md b/files/en-us/web/api/cookiechangeevent/deleted/index.md index 0d1867d7170d426..5e6fdd478306417 100644 --- a/files/en-us/web/api/cookiechangeevent/deleted/index.md +++ b/files/en-us/web/api/cookiechangeevent/deleted/index.md @@ -25,7 +25,7 @@ An array of objects containing the deleted cookie(s). Each object contains the f - `path` - : A string containing the path of the cookie. - `expires` - - : A timestamp, given as [Unix time](/en-US/docs/Glossary/Unix_time) in milliseconds, containing the expiration date of the cookie. + - : A timestamp, given as {{glossary("Unix time")}} in milliseconds, containing the expiration date of the cookie. - `secure` - : A {{jsxref("boolean")}} indicating whether the cookie is from a site with a secure context (HTTPS rather than HTTP). - `sameSite` @@ -44,7 +44,7 @@ An array of objects containing the deleted cookie(s). Each object contains the f ## Examples -In this example when the cookie is deleted the event listener logs the first item in the `CookieChangeEvent.deleted` property to the console. It contains an object representing the cookie that has just been deleted. +In this example, when the cookie is deleted, the event listener logs the first item in the `CookieChangeEvent.deleted` property to the console. It contains an object representing the cookie that has just been deleted. ```js cookieStore.addEventListener("change", (event) => { diff --git a/files/en-us/web/api/cookiechangeevent/index.md b/files/en-us/web/api/cookiechangeevent/index.md index 0387e89c560cc8b..b3cd59ac7097b6a 100644 --- a/files/en-us/web/api/cookiechangeevent/index.md +++ b/files/en-us/web/api/cookiechangeevent/index.md @@ -9,12 +9,12 @@ browser-compat: api.CookieChangeEvent {{securecontext_header}}{{APIRef("Cookie Store API")}}{{SeeCompatTable}} -The **`CookieChangeEvent`** interface of the ['Cookie Store API'](/en-US/docs/Web/API/Cookie_Store_API) is the event type of the {{domxref("CookieStore.change_event", "change")}} event fired at a {{domxref("CookieStore")}} when any cookie changes occur. A cookie change consists of a cookie and a type (either "changed" or "deleted"). +The **`CookieChangeEvent`** interface of the {{domxref("Cookie Store API", "", "", "nocode")}} is the event type of the {{domxref("CookieStore/change_event", "change")}} event fired at a {{domxref("CookieStore")}} when any cookie changes occur. A cookie change consists of a cookie and a type (either "changed" or "deleted"). Cookie changes that will cause the `CookieChangeEvent` to be dispatched are: - A cookie is newly created and not immediately removed. In this case `type` is "changed". -- A cookie is newly created and immediately removed. In this case `type` is "deleted" +- A cookie is newly created and immediately removed. In this case `type` is "deleted". - A cookie is removed. In this case `type` is "deleted". > **Note:** A cookie that is replaced due to the insertion of another cookie with the same name, domain, and path, is ignored and does not trigger a change event.