Skip to content

Commit

Permalink
Instead of detecting browser, detect if document is available
Browse files Browse the repository at this point in the history
  • Loading branch information
Havunen committed Oct 14, 2018
1 parent 2d2cdb1 commit 7c11d87
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/inferno/src/DOM/rendering.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ import { patch } from './patching';
import { remove } from './unmounting';
import { callAll, options, EMPTY_OBJ, LIFECYCLE } from './utils/common';

const isBrowser: boolean = typeof window !== 'undefined';
const hasDocumentAvailable: boolean = typeof document !== 'undefined';

if (process.env.NODE_ENV !== 'production') {
if (isBrowser && !document.body) {
if (hasDocumentAvailable && !document.body) {
warning(
'Inferno warning: you cannot initialize inferno without "document.body". Wait on "DOMContentLoaded" event, add script to bottom of body, or use async/defer attributes on script tag.'
);
}
}

const documentBody = isBrowser ? document.body : null;
const documentBody = hasDocumentAvailable ? document.body : null;

export function __render(
input: VNode | null | InfernoNode | undefined,
Expand Down

0 comments on commit 7c11d87

Please sign in to comment.