Skip to content

Commit

Permalink
Constructors without "new" throw (#2827); r=Ms2ger
Browse files Browse the repository at this point in the history
Not yet in a spec, but heycam told me this is the correct behavior, and
Ms2ger recommended updating the test without waiting for the spec to be
updated.  Spec bug: https://www.w3.org/Bugs/Public/show_bug.cgi?id=22808
  • Loading branch information
ayg authored and Ms2ger committed Apr 13, 2016
1 parent d4d95f0 commit da1d328
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions dom/events/Event-constructors.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,8 @@
assert_true("initEvent" in ev)
})
test(function() {
var ev = Event("test")
assert_equals(ev.type, "test")
assert_equals(ev.target, null)
assert_equals(ev.currentTarget, null)
assert_equals(ev.eventPhase, Event.NONE)
assert_equals(ev.bubbles, false)
assert_equals(ev.cancelable, false)
assert_equals(ev.defaultPrevented, false)
assert_equals(ev.isTrusted, false)
assert_true(ev.timeStamp > 0)
assert_true("initEvent" in ev)
assert_throws(new TypeError(), function() { Event("test") },
'Calling Event constructor without "new" must throw');
})
test(function() {
var ev = new Event("I am an event", { bubbles: true, cancelable: false})
Expand Down

0 comments on commit da1d328

Please sign in to comment.