| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -867,8 +867,6 @@ class EventTarget { | |||
| 867 | 867 | return new CustomEvent(type, { detail: nodeValue }); | |
| 868 | 868 | } | |
| 869 | 869 | [customInspectSymbol](depth, options) { | |
| 870 | - if (!isEventTarget(this)) | ||
| 871 | - throw new ERR_INVALID_THIS('EventTarget'); | ||
| 872 | 870 | const name = this.constructor.name; | |
| 873 | 871 | if (depth < 0) | |
| 874 | 872 | return name; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,19 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + | ||
| 3 | + require('../common'); | ||
| 4 | + const assert = require('assert'); | ||
| 5 | + const util = require('util'); | ||
| 6 | + | ||
| 7 | + const symbol = util.inspect.custom; | ||
| 8 | + | ||
| 9 | + const eventTargetInspect = EventTarget.prototype[symbol]; | ||
| 10 | + | ||
| 11 | + const fakeEventTarget = { | ||
| 12 | + [symbol]: eventTargetInspect, | ||
| 13 | + someOtherField: 42 | ||
| 14 | + }; | ||
| 15 | + | ||
| 16 | + // Should not throw when calling the custom inspect method | ||
| 17 | + const output = util.inspect(fakeEventTarget); | ||
| 18 | + | ||
| 19 | + assert.strictEqual(typeof output, 'string'); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments