Skip to content

Commit

Permalink
Don't attempt to create element in Node.js environment
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert-Frampton authored and Robert-Frampton committed Oct 2, 2017
1 parent 8fe3762 commit 59a922d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/metal-incremental-dom/src/render/patch.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import { append, exitDocument } from 'metal-dom';
import { getData } from '../data';
import { isFunction } from 'metal';
import { render } from './render';

const patchingComponents_ = [];
Expand All @@ -15,7 +16,10 @@ const patchingComponents_ = [];
*/
function buildParentIfNecessary_(element) {
if (!element || !element.parentNode) {
const parent = document.createElement('div');
let parent = {};
if (typeof document !== 'undefined' && isFunction(document.createElement)) {
parent = document.createElement('div');
}
if (element) {
append(parent, element);
}
Expand Down

0 comments on commit 59a922d

Please sign in to comment.