mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
events: remove eventtarget custom inspect branding
PR-URL: https://github.com/nodejs/node/pull/61128 Reviewed-By: Aviv Keller <me@aviv.sh> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
@@ -867,8 +867,6 @@ class EventTarget {
|
||||
return new CustomEvent(type, { detail: nodeValue });
|
||||
}
|
||||
[customInspectSymbol](depth, options) {
|
||||
if (!isEventTarget(this))
|
||||
throw new ERR_INVALID_THIS('EventTarget');
|
||||
const name = this.constructor.name;
|
||||
if (depth < 0)
|
||||
return name;
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
'use strict';
|
||||
|
||||
require('../common');
|
||||
const assert = require('assert');
|
||||
const util = require('util');
|
||||
|
||||
const symbol = util.inspect.custom;
|
||||
|
||||
const eventTargetInspect = EventTarget.prototype[symbol];
|
||||
|
||||
const fakeEventTarget = {
|
||||
[symbol]: eventTargetInspect,
|
||||
someOtherField: 42
|
||||
};
|
||||
|
||||
// Should not throw when calling the custom inspect method
|
||||
const output = util.inspect(fakeEventTarget);
|
||||
|
||||
assert.strictEqual(typeof output, 'string');
|
||||
Reference in New Issue
Block a user