diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2021-06-24 14:21:13 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-24 14:21:13 -0400 |
commit | 586586b7911088086c99dfeb5a4b082dc1393c62 (patch) | |
tree | a0810bae2a513d54ce5eb754d3615f60ce7e698a /extensions/web/02_event.js | |
parent | a2067ec46d410b691229b6fcaa12ff5f1dd223f3 (diff) |
fix: make readonly `Event` properties readonly (#11106)
Diffstat (limited to 'extensions/web/02_event.js')
-rw-r--r-- | extensions/web/02_event.js | 75 |
1 files changed, 23 insertions, 52 deletions
diff --git a/extensions/web/02_event.js b/extensions/web/02_event.js index 40cfd30a8..7a270881f 100644 --- a/extensions/web/02_event.js +++ b/extensions/web/02_event.js @@ -150,27 +150,23 @@ get type() { return this[_attributes].type; } - set type(_) { - // this is a no-op because this member is readonly - } + get target() { return this[_attributes].target; } - set target(_) { - // this is a no-op because this member is readonly - } + get srcElement() { return null; } + set srcElement(_) { - // this is a no-op because this member is readonly + // this member is deprecated } + get currentTarget() { return this[_attributes].currentTarget; } - set currentTarget(_) { - // this is a no-op because this member is readonly - } + composedPath() { const path = this[_path]; if (path.length === 0) { @@ -279,67 +275,51 @@ get NONE() { return Event.NONE; } - set NONE(_) { - // this is a no-op because this member is readonly - } + get CAPTURING_PHASE() { return Event.CAPTURING_PHASE; } - set CAPTURING_PHASE(_) { - // this is a no-op because this member is readonly - } + get AT_TARGET() { return Event.AT_TARGET; } - set AT_TARGET(_) { - // this is a no-op because this member is readonly - } + get BUBBLING_PHASE() { return Event.BUBBLING_PHASE; } - set BUBBLING_PHASE(_) { - // this is a no-op because this member is readonly - } + static get NONE() { return 0; } - static set NONE(_) { - // this is a no-op because this member is readonly - } + static get CAPTURING_PHASE() { return 1; } - static set CAPTURING_PHASE(_) { - // this is a no-op because this member is readonly - } + static get AT_TARGET() { return 2; } - static set AT_TARGET(_) { - // this is a no-op because this member is readonly - } + static get BUBBLING_PHASE() { return 3; } - static set BUBBLING_PHASE(_) { - // this is a no-op because this member is readonly - } + get eventPhase() { return this[_attributes].eventPhase; } - set eventPhase(_) { - // this is a no-op because this member is readonly - } stopPropagation() { this[_stopPropagationFlag] = true; } + get cancelBubble() { return this[_stopPropagationFlag]; } + set cancelBubble(value) { this[_stopPropagationFlag] = webidl.converters.boolean(value); } + stopImmediatePropagation() { this[_stopPropagationFlag] = true; this[_stopImmediatePropagationFlag] = true; @@ -348,40 +328,34 @@ get bubbles() { return this[_attributes].bubbles; } - set bubbles(_) { - // this is a no-op because this member is readonly - } + get cancelable() { return this[_attributes].cancelable; } - set cancelable(value) { - // this is a no-op because this member is readonly - } + get returnValue() { return !this[_canceledFlag]; } + set returnValue(value) { if (!webidl.converters.boolean(value)) { this[_canceledFlag] = true; } } + preventDefault() { if (this[_attributes].cancelable && !this[_inPassiveListener]) { this[_canceledFlag] = true; } } + get defaultPrevented() { return this[_canceledFlag]; } - set defaultPrevented(_) { - // this is a no-op because this member is readonly - } + get composed() { return this[_attributes].composed; } - set composed(_) { - // this is a no-op because this member is readonly - } get initialized() { return true; @@ -390,9 +364,6 @@ get timeStamp() { return this[_attributes].timeStamp; } - set timeStamp(_) { - // this is a no-op because this member is readonly - } } function buildFilteredPropertyInspectObject(object, keys) { |