mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-12-14 15:28:57 +00:00
Merge pull request #1251 from axlEscalada/axlescalada/fix-alignment-event-target
fix alignment event target
This commit is contained in:
@@ -95,6 +95,7 @@ pub const EventTarget = struct {
|
||||
// --------
|
||||
pub fn constructor(page: *Page) !*parser.EventTarget {
|
||||
const et = try page.arena.create(EventTarget);
|
||||
et.* = .{};
|
||||
return @ptrCast(&et.base);
|
||||
}
|
||||
|
||||
|
||||
@@ -113,4 +113,13 @@
|
||||
// doesn't crash on null receiver
|
||||
content.addEventListener('he2', null);
|
||||
content.dispatchEvent(new Event('he2'));
|
||||
|
||||
// Test that EventTarget constructor properly initializes vtable
|
||||
const et = new EventTarget();
|
||||
testing.expectEqual('[object EventTarget]', et.toString());
|
||||
|
||||
let constructorTestCalled = false;
|
||||
et.addEventListener('test', () => { constructorTestCalled = true; });
|
||||
et.dispatchEvent(new Event('test'));
|
||||
testing.expectEqual(true, constructorTestCalled);
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user