Skip to content

Commit f4bd5a3

Browse files
committed
fix(platform-server): Do not delete global Event (#53659)
This commit removes a hack that deletes `Event` from the global context when using domino. Instead, it sets the global event to domino's implementation of `Event`. PR Close #53659
1 parent 36318db commit f4bd5a3

File tree

2 files changed

+2
-12
lines changed

2 files changed

+2
-12
lines changed

packages/core/test/render3/load_domino.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,10 @@ if (typeof window == 'undefined') {
1818
DominoAdapter.makeCurrent();
1919
(global as any).document = getDOM().getDefaultDocument();
2020

21-
// Trick to avoid Event patching from
22-
// https://github.com/angular/angular/blob/7cf5e95ac9f0f2648beebf0d5bd9056b79946970/packages/platform-browser/src/dom/events/dom_events.ts#L112-L132
23-
// It fails with Domino with TypeError: Cannot assign to read only property
24-
// 'stopImmediatePropagation' of object '#<Event>'
25-
(global as any).Event = null;
26-
2721
// For animation tests, see
2822
// https://github.com/angular/angular/blob/main/packages/animations/browser/src/render/shared.ts#L140
2923
(global as any).Element = domino.impl.Element;
3024
(global as any).isBrowser = false;
3125
(global as any).isNode = true;
26+
(global as any).Event = domino.impl.Event;
3227
}

packages/private/testing/src/utils.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ async function loadDominoOrNull():
130130

131131
/**
132132
* Ensure that global has `Document` if we are in node.js
133-
* @publicApi
134133
*/
135134
export async function ensureDocument(): Promise<void> {
136135
if ((global as any).isBrowser) {
@@ -147,11 +146,7 @@ export async function ensureDocument(): Promise<void> {
147146
savedDocument = (global as any).document;
148147
(global as any).window = window;
149148
(global as any).document = window.document;
150-
// Trick to avoid Event patching from
151-
// https://github.com/angular/angular/blob/7cf5e95ac9f0f2648beebf0d5bd9056b79946970/packages/platform-browser/src/dom/events/dom_events.ts#L112-L132
152-
// It fails with Domino with TypeError: Cannot assign to read only property
153-
// 'stopImmediatePropagation' of object '#<Event>'
154-
(global as any).Event = null;
149+
(global as any).Event = domino.impl.Event;
155150
savedNode = (global as any).Node;
156151
// Domino types do not type `impl`, but it's a documented field.
157152
// See: https://www.npmjs.com/package/domino#usage.

0 commit comments

Comments
 (0)