From aaf884b70ac6b0fce49a3e11dfea6de99c25e52d Mon Sep 17 00:00:00 2001 From: Devin Weaver Date: Mon, 11 Jul 2016 08:46:22 -0400 Subject: [PATCH] Add this.document to ES2016 documentation (#2314) In the sample example for using ES2016 it used the `$tw.utils.domMaker()`. I just found out that if this code is executed by Node.js instead of in the browser that it doesn't work because `window.document` doesn't exist. The expectation is that widgets pass in the fake `this.document`. I updated the example to reflect this. --- .../tiddlers/howtos/Using ES2016 for Writing Plugins.tid | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/editions/tw5.com/tiddlers/howtos/Using ES2016 for Writing Plugins.tid b/editions/tw5.com/tiddlers/howtos/Using ES2016 for Writing Plugins.tid index ca4ab0d64..f34d10a4a 100644 --- a/editions/tw5.com/tiddlers/howtos/Using ES2016 for Writing Plugins.tid +++ b/editions/tw5.com/tiddlers/howtos/Using ES2016 for Writing Plugins.tid @@ -1,4 +1,4 @@ -modified: 20160112175004000 +modified: 20160305222940000 created: 20160111034749658 tags: documenting Concepts title: Using ES2016 for Writing Plugins @@ -154,7 +154,10 @@ class ClockWidget extends Widget { this.logger.log('Rendering clock DOM nodes'); this.computeAttributes() this.parentDomNode = parent; - this.domNode = $tw.utils.domMaker('div', {class: 'tc-clock-widget'}); + this.domNode = $tw.utils.domMaker('div', { + document: this.document, + class: 'tc-clock-widget' + }); parent.insertBefore(this.domNode, nextSibling); this.tick(); }