Skip to content

Commit

Permalink
events: remove srcElement from Event
Browse files Browse the repository at this point in the history
`srcElement` is deprecated. So remove it from Event.

Refs: https://developer.mozilla.org/en-US/docs/Web/API/Event/srcElement
  • Loading branch information
deokjinkim committed Jan 4, 2023
1 parent 57048ac commit 28415d3
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 24 deletions.
10 changes: 0 additions & 10 deletions doc/api/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -1846,16 +1846,6 @@ added: v14.5.0

This is not used in Node.js and is provided purely for completeness.

#### `event.srcElement`

<!-- YAML
added: v14.5.0
-->

* Type: {EventTarget} The `EventTarget` dispatching the event.

Alias for `event.target`.

#### `event.stopImmediatePropagation()`

<!-- YAML
Expand Down
10 changes: 0 additions & 10 deletions lib/internal/event_target.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,15 +172,6 @@ class Event {
return this[kTarget];
}

/**
* @type {EventTarget}
*/
get srcElement() {
if (!isEvent(this))
throw new ERR_INVALID_THIS('Event');
return this[kTarget];
}

/**
* @type {string}
*/
Expand Down Expand Up @@ -311,7 +302,6 @@ ObjectDefineProperties(
preventDefault: kEnumerableProperty,
target: kEnumerableProperty,
currentTarget: kEnumerableProperty,
srcElement: kEnumerableProperty,
type: kEnumerableProperty,
cancelable: kEnumerableProperty,
defaultPrevented: kEnumerableProperty,
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-events-customevent.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,6 @@ const { Event, EventTarget, CustomEvent } = require('internal/event_target');
common.mustCall((event) => {
strictEqual(event.target, target);
strictEqual(event.currentTarget, target);
strictEqual(event.srcElement, target);
strictEqual(event.detail, obj);
}),
);
Expand Down
2 changes: 0 additions & 2 deletions test/parallel/test-eventtarget-brandcheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const {
[
'target',
'currentTarget',
'srcElement',
'type',
'cancelable',
'defaultPrevented',
Expand Down Expand Up @@ -44,7 +43,6 @@ const {
[
'target',
'currentTarget',
'srcElement',
'type',
'cancelable',
'defaultPrevented',
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-eventtarget.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,6 @@ let asyncTest = Promise.resolve();
target.addEventListener('foo', common.mustCall((event) => {
strictEqual(event.target, target);
strictEqual(event.currentTarget, target);
strictEqual(event.srcElement, target);
}));
target.dispatchEvent(event);
}
Expand Down

0 comments on commit 28415d3

Please sign in to comment.