diff options
author | Aaron O'Mullan <aaron.omullan@gmail.com> | 2021-09-26 20:41:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-26 20:41:05 +0200 |
commit | 5788f2e0829a80fe3ef96c177c80be89a9d155c3 (patch) | |
tree | 26defaf7a23c24df653a84672101e5594f55ff19 /ext/web/02_event.js | |
parent | 1749e79f97af29262c88c66c3a834e8eff4197c6 (diff) |
perf(web): optimize Event constructor (#12231)
Assign in constructor instead of using class initializers which are currently ~10x slower
Diffstat (limited to 'ext/web/02_event.js')
-rw-r--r-- | ext/web/02_event.js | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/ext/web/02_event.js b/ext/web/02_event.js index f54e3d8a3..340f5e03b 100644 --- a/ext/web/02_event.js +++ b/ext/web/02_event.js @@ -135,16 +135,15 @@ const _path = Symbol("[[path]]"); class Event { - [_attributes] = {}; - [_canceledFlag] = false; - [_stopPropagationFlag] = false; - [_stopImmediatePropagationFlag] = false; - [_inPassiveListener] = false; - [_dispatched] = false; - [_isTrusted] = false; - [_path] = []; - constructor(type, eventInitDict = {}) { + this[_canceledFlag] = false; + this[_stopPropagationFlag] = false; + this[_stopImmediatePropagationFlag] = false; + this[_inPassiveListener] = false; + this[_dispatched] = false; + this[_isTrusted] = false; + this[_path] = []; + webidl.requiredArguments(arguments.length, 1, { prefix: "Failed to construct 'Event'", }); |