refactor(core): move sanitization into core (#22540)
This is in preparation of having Ivy have sanitization inline. PR Close #22540
This commit is contained in:

committed by
Kara Erickson

parent
065bcc5aad
commit
538f1d980f
@ -53,6 +53,7 @@ export function withBody<T>(html: string, blockFn: T): T {
|
||||
|
||||
let savedDocument: Document|undefined = undefined;
|
||||
let savedRequestAnimationFrame: ((callback: FrameRequestCallback) => number)|undefined = undefined;
|
||||
let savedNode: typeof Node|undefined = undefined;
|
||||
let requestAnimationFrameCount = 0;
|
||||
|
||||
/**
|
||||
@ -87,6 +88,8 @@ export function ensureDocument(): void {
|
||||
// It fails with Domino with TypeError: Cannot assign to read only property
|
||||
// 'stopImmediatePropagation' of object '#<Event>'
|
||||
(global as any).Event = null;
|
||||
savedNode = (global as any).Node;
|
||||
(global as any).Node = domino.impl.Node;
|
||||
|
||||
savedRequestAnimationFrame = (global as any).requestAnimationFrame;
|
||||
(global as any).requestAnimationFrame = function(cb: FrameRequestCallback): number {
|
||||
@ -105,6 +108,10 @@ export function cleanupDocument(): void {
|
||||
(global as any).document = savedDocument;
|
||||
savedDocument = undefined;
|
||||
}
|
||||
if (savedNode) {
|
||||
(global as any).Node = savedNode;
|
||||
savedNode = undefined;
|
||||
}
|
||||
if (savedRequestAnimationFrame) {
|
||||
(global as any).requestAnimationFrame = savedRequestAnimationFrame;
|
||||
savedRequestAnimationFrame = undefined;
|
||||
|
Reference in New Issue
Block a user