Skip to content

Commit 6da85b5

Browse files
efekrsklRafaelGSS
authored andcommitted
events: remove eventtarget custom inspect branding
PR-URL: #61128 Reviewed-By: Aviv Keller <me@aviv.sh> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
1 parent 3c5dc03 commit 6da85b5

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

‎lib/internal/event_target.js‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -867,8 +867,6 @@ class EventTarget {
867867
returnnewCustomEvent(type,{detail: nodeValue});
868868
}
869869
[customInspectSymbol](depth,options){
870-
if(!isEventTarget(this))
871-
thrownewERR_INVALID_THIS('EventTarget');
872870
constname=this.constructor.name;
873871
if(depth<0)
874872
returnname;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
'use strict';
2+
3+
require('../common');
4+
constassert=require('assert');
5+
constutil=require('util');
6+
7+
constsymbol=util.inspect.custom;
8+
9+
consteventTargetInspect=EventTarget.prototype[symbol];
10+
11+
constfakeEventTarget={
12+
[symbol]: eventTargetInspect,
13+
someOtherField: 42
14+
};
15+
16+
// Should not throw when calling the custom inspect method
17+
constoutput=util.inspect(fakeEventTarget);
18+
19+
assert.strictEqual(typeofoutput,'string');

0 commit comments

Comments
 (0)