Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a317325

Browse files
committed
refactor: provide fake polyfill for global.document
1 parent 4154575 commit a317325

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

‎nativescript-angular/animations/animations.module.ts‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,6 @@ import { NativeScriptModule } from "../nativescript.module";
1818
import { NativeScriptRendererFactory } from "../renderer";
1919
import { NativeScriptAnimationDriver } from "./animation-driver";
2020

21-
(<any>global).document = {
22-
body: {
23-
isOverride: true,
24-
}
25-
};
26-
2721
@Injectable()
2822
export class InjectableAnimationEngine extends AnimationEngine {
2923
constructor(driver: AnimationDriver, normalizer: AnimationStyleNormalizer) {

‎nativescript-angular/platform.ts‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ import {
3232
StaticProvider,
3333
} from "@angular/core";
3434

35+
// Add a fake polyfill for the document object
36+
(<any>global).document = (<any>global).document || {};
37+
const doc = (<any>global).document;
38+
doc.body = Object.assign((doc.body || {}), {
39+
isOverride: true,
40+
});
41+
3542
// Work around a TS bug requiring an imports of
3643
// InjectionToken, ViewEncapsulation and MissingTranslationStrategy
3744
// without using them
@@ -62,7 +69,7 @@ export const NS_COMPILER_PROVIDERS: StaticProvider[] = [
6269
},
6370
{
6471
provide: DOCUMENT,
65-
useValue: {body: {isOverride: true}},
72+
useValue: doc,
6673
},
6774
];
6875

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /