From 558b1794cabcce7c769174e94d60f5912a39d1a0 Mon Sep 17 00:00:00 2001 From: Luke Childs Date: Mon, 10 Apr 2017 14:40:49 +0700 Subject: [PATCH] Don't modify document in example fn to make it less confusing --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bc5c828..07ff1dc 100644 --- a/README.md +++ b/README.md @@ -62,8 +62,9 @@ You can use a really simple pattern to enable your browser modules to run in Nod module.exports = function(text, win) { win = win || window; - win.document.body.innerHTML = `

${text}

`; - return window.document.querySelector('h1'); + const div = win.document.createElement('div'); + div.innerHTML = `

${text}

`; + return div.querySelector('h1'); }; ```