File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed
Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,7 @@ pub const EventTarget = struct {
9595 // --------
9696 pub fn constructor (page : * Page ) ! * parser.EventTarget {
9797 const et = try page .arena .create (EventTarget );
98+ et .* = .{};
9899 return @ptrCast (& et .base );
99100 }
100101
Original file line number Diff line number Diff line change 113113 // doesn't crash on null receiver
114114 content . addEventListener ( 'he2' , null ) ;
115115 content . dispatchEvent ( new Event ( 'he2' ) ) ;
116+
117+ // Test that EventTarget constructor properly initializes vtable
118+ const et = new EventTarget ( ) ;
119+ testing . expectEqual ( '[object EventTarget]' , et . toString ( ) ) ;
120+
121+ let constructorTestCalled = false ;
122+ et . addEventListener ( 'test' , ( ) => { constructorTestCalled = true ; } ) ;
123+ et . dispatchEvent ( new Event ( 'test' ) ) ;
124+ testing . expectEqual ( true , constructorTestCalled ) ;
116125</ script >
You can’t perform that action at this time.
0 commit comments