From 9dd8e8475684d843fa19ba85ab0b3376a3971707 Mon Sep 17 00:00:00 2001 From: Deokjin Kim Date: Tue, 27 Dec 2022 18:29:20 +0900 Subject: [PATCH 1/4] doc: fix setter of `event.cancelBubble` Setter of `event.cancelBubble` needs 1 argument(value). And event.cancelBubble() is working if value is true. But it's not described properly. Refs: https://dom.spec.whatwg.org/#interface-event --- doc/api/events.md | 8 +++++--- lib/internal/event_target.js | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/doc/api/events.md b/doc/api/events.md index 46bc97fb80476f..b7572c9fbf414a 100644 --- a/doc/api/events.md +++ b/doc/api/events.md @@ -1748,14 +1748,16 @@ added: v14.5.0 This is not used in Node.js and is provided purely for completeness. -#### `event.cancelBubble()` +#### `event.cancelBubble(value)` -Alias for `event.stopPropagation()`. This is not used in Node.js and is -provided purely for completeness. +* `value` {boolean} + +Alias for `event.stopPropagation()` if `value` is `true`. This is not used +in Node.js and is provided purely for completeness. #### `event.cancelable` diff --git a/lib/internal/event_target.js b/lib/internal/event_target.js index 863c1c6ea8bd01..4b2d6ef4d16ea8 100644 --- a/lib/internal/event_target.js +++ b/lib/internal/event_target.js @@ -276,7 +276,7 @@ class Event { } /** - * @type {boolean} + * @param {boolean} value */ set cancelBubble(value) { if (!isEvent(this)) From e32078957c514796047caf9ca316025e3f5d7830 Mon Sep 17 00:00:00 2001 From: Deokjin Kim Date: Wed, 28 Dec 2022 23:10:59 +0900 Subject: [PATCH 2/4] Apply suggestions from code review Co-authored-by: Antoine du Hamel --- doc/api/events.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/api/events.md b/doc/api/events.md index b7572c9fbf414a..c79c0af4dbb831 100644 --- a/doc/api/events.md +++ b/doc/api/events.md @@ -1748,15 +1748,15 @@ added: v14.5.0 This is not used in Node.js and is provided purely for completeness. -#### `event.cancelBubble(value)` +#### `event.cancelBubble` -* `value` {boolean} +* {boolean} -Alias for `event.stopPropagation()` if `value` is `true`. This is not used +Alias for `event.stopPropagation()` if set to `true`. This is not used in Node.js and is provided purely for completeness. #### `event.cancelable` From 8f78b2eac7460fbf137faaa1ea39719e9af48a48 Mon Sep 17 00:00:00 2001 From: Deokjin Kim Date: Thu, 29 Dec 2022 07:42:22 +0900 Subject: [PATCH 3/4] Add missed `Type:` to specify data type Co-authored-by: Antoine du Hamel --- doc/api/events.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/events.md b/doc/api/events.md index c79c0af4dbb831..f1a6e5efb980d7 100644 --- a/doc/api/events.md +++ b/doc/api/events.md @@ -1754,7 +1754,7 @@ This is not used in Node.js and is provided purely for completeness. added: v14.5.0 --> -* {boolean} +* Type: {boolean} Alias for `event.stopPropagation()` if set to `true`. This is not used in Node.js and is provided purely for completeness. From 31f921ee0e1e3f194db78b772031d089fc1cbe23 Mon Sep 17 00:00:00 2001 From: Deokjin Kim Date: Thu, 29 Dec 2022 07:50:01 +0900 Subject: [PATCH 4/4] Revert change of JSDoc Co-authored-by: Antoine du Hamel --- lib/internal/event_target.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/event_target.js b/lib/internal/event_target.js index 4b2d6ef4d16ea8..863c1c6ea8bd01 100644 --- a/lib/internal/event_target.js +++ b/lib/internal/event_target.js @@ -276,7 +276,7 @@ class Event { } /** - * @param {boolean} value + * @type {boolean} */ set cancelBubble(value) { if (!isEvent(this))