Skip to content

Commit e5f44fd

Browse files
committed
add polyfill for tests
1 parent f51ee7f commit e5f44fd

File tree

5 files changed

+6063
-1
lines changed

5 files changed

+6063
-1
lines changed

src/browser/polyfill/focusevent.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
(function() {
2+
// critically in Phantom JS it is an object so can't be used as a constructor.
3+
if (typeof FocusEvent !== 'function') {
4+
window.FocusEvent = function(eventType, init) {
5+
init = init || {};
6+
var focusEvent = document.createEvent('Event');
7+
focusEvent.initUIEvent(
8+
eventType,
9+
false,
10+
false,
11+
window,
12+
init.detail
13+
);
14+
15+
return focusEvent;
16+
}
17+
}
18+
})();

src/browser/polyfill/polyfill.zig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ const modules = [_]struct {
2828
source: []const u8,
2929
}{
3030
.{ .name = "polyfill-fetch", .source = @import("fetch.zig").source },
31+
.{ .name = "polyfill-focusevent", .source = @import("shadowdom.zig").focusevent },
32+
.{ .name = "polyfill-shadowdom", .source = @import("shadowdom.zig").source },
3133
};
3234

3335
pub fn load(allocator: Allocator, js_context: *Env.JsContext) !void {

0 commit comments

Comments
 (0)