From 2724514f531f2ddec01bd8a811ed94012a6bed5d Mon Sep 17 00:00:00 2001 From: Benjamin Gruenbaum Date: Thu, 28 May 2020 17:33:21 +0300 Subject: [PATCH] event: cancelBubble is a property MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Event#cancelBubble is property (and not a function). Change Event#cancelBubble to a property and add a test. PR-URL: https://github.com/nodejs/node/pull/33613 Reviewed-By: James M Snell Reviewed-By: Michaël Zasso Reviewed-By: Ruben Bridgewater Reviewed-By: Juan José Arboleda PR-URL: https://github.com/nodejs/node/pull/34015 Reviewed-By: Denys Otrishko Reviewed-By: Benjamin Gruenbaum --- test/parallel/test-eventtarget.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/parallel/test-eventtarget.js b/test/parallel/test-eventtarget.js index 743221316382b8..672917b860dabb 100644 --- a/test/parallel/test-eventtarget.js +++ b/test/parallel/test-eventtarget.js @@ -70,6 +70,24 @@ ok(EventTarget); const ev = new Event('foo', {}, {}); strictEqual(ev.type, 'foo'); } +{ +const ev = new Event('foo'); + strictEqual(ev.cancelBubble, false); + ev.cancelBubble = true; + strictEqual(ev.cancelBubble, true); +} +{ + const ev = new Event('foo'); + strictEqual(ev.cancelBubble, false); + ev.stopPropagation(); + strictEqual(ev.cancelBubble, true); +} +{ + const ev = new Event('foo'); + strictEqual(ev.cancelBubble, false); + ev.cancelBubble = 'some-truthy-value'; + strictEqual(ev.cancelBubble, true); +} { const ev = new Event('foo', { cancelable: true }); strictEqual(ev.type, 'foo');