diff options
author | 迷渡 <justjavac@gmail.com> | 2019-03-26 19:42:26 +0800 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2019-03-26 07:42:26 -0400 |
commit | ed2977d3c0e9ab3295a3bb47b844b2953d608197 (patch) | |
tree | e5cf368acf41d9883d29efbdf837843695fe880e /js/event.ts | |
parent | d8714281b40f457420608c7e766fe787609c7afb (diff) |
Check `Event` constructor params (#1997)
Diffstat (limited to 'js/event.ts')
-rw-r--r-- | js/event.ts | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/js/event.ts b/js/event.ts index f39739190..61f21f2e7 100644 --- a/js/event.ts +++ b/js/event.ts @@ -1,6 +1,6 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. import * as domTypes from "./dom_types"; -import { getPrivateValue } from "./util"; +import { getPrivateValue, requiredArguments } from "./util"; // WeakMaps are recommended for private attributes (see MDN link below) // https://developer.mozilla.org/en-US/docs/Archive/Add-ons/Add-on_SDK/Guides/Contributor_s_Guide/Private_Properties#Using_WeakMaps @@ -31,6 +31,8 @@ export class Event implements domTypes.Event { private _path: domTypes.EventPath[] = []; constructor(type: string, eventInitDict: domTypes.EventInit = {}) { + requiredArguments("Event", arguments.length, 1); + type = String(type); this._initializedFlag = true; eventAttributes.set(this, { type, |