From cecf89516eeadccc6746c12d577b3da8835a67ec Mon Sep 17 00:00:00 2001 From: David Greenspan Date: Thu, 28 Aug 2014 00:53:22 -0700 Subject: [PATCH] Call the template instance `template`, not `this` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit But keep some occurrences of `this` for clarity; for example, “in a rendered callback you can use `this.findAll`”. --- docs/client/api.html | 10 +++++----- docs/client/api.js | 14 +++++++------- docs/client/docs.js | 16 ++++++++-------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/docs/client/api.html b/docs/client/api.html index d2d95cd508..db6263bd30 100644 --- a/docs/client/api.html +++ b/docs/client/api.html @@ -2097,7 +2097,7 @@ the template and persists across re-renderings. Use the `created` and object. Because your template has been rendered, you can use functions like -`this.findAll` which look at its DOM nodes. +[`this.findAll`](#template_findAll) which look at its DOM nodes. {{> api_box template_created}} @@ -2154,9 +2154,9 @@ Template instance objects are `instanceof UI.TemplateInstance`. {{> api_box template_findAll}} -`this.findAll` returns an array of DOM elements matching `selector`. +`template.findAll` returns an array of DOM elements matching `selector`. -`this.$` returns a [jQuery object](http://api.jquery.com/Types/#jQuery) of +`template.$` returns a [jQuery object](http://api.jquery.com/Types/#jQuery) of those same elements. jQuery objects are similar to arrays, with additional methods defined by the jQuery library. @@ -2196,7 +2196,7 @@ You can use `this.autorun` from a [`created`](#template_created) or or the template instance. The Computation is automatically stopped when the template is destroyed. -Alias for `this.view.autorun`. +Alias for `template.view.autorun`. {{> api_box template_view}} @@ -2335,7 +2335,7 @@ way to understand and customize Meteor's rendering behavior for more advanced applications and packages. You can obtain a View object by calling [`UI.render`](#ui_render) on a -template, or by accessing [`this.view`](#template_view) on a template +template, or by accessing [`template.view`](#template_view) on a template instance. At the heart of a View is an [autorun](#tracker_autorun) that calls the View's diff --git a/docs/client/api.js b/docs/client/api.js index 6489bf19e0..972777b1bf 100644 --- a/docs/client/api.js +++ b/docs/client/api.js @@ -1771,7 +1771,7 @@ Template.api.template_helpers = { Template.api.template_findAll = { id: "template_findAll", - name: "this.findAll(selector) and this.$(selector)", + name: "template.findAll(selector) and template.$(selector)", locus: "Client", descr: ["Find all elements matching `selector` in this template instance."], args: [ @@ -1783,7 +1783,7 @@ Template.api.template_findAll = { Template.api.template_find = { id: "template_find", - name: "this.find(selector)", + name: "template.find(selector)", locus: "Client", descr: ["Find one element matching `selector` in this template instance."], args: [ @@ -1795,28 +1795,28 @@ Template.api.template_find = { Template.api.template_firstNode = { id: "template_firstNode", - name: "this.firstNode", + name: "template.firstNode", locus: "Client", descr: ["The first top-level DOM node in this template instance."] }; Template.api.template_lastNode = { id: "template_lastNode", - name: "this.lastNode", + name: "template.lastNode", locus: "Client", descr: ["The last top-level DOM node in this template instance."] }; Template.api.template_data = { id: "template_data", - name: "this.data", + name: "template.data", locus: "Client", descr: ["The data context of this instance's latest invocation."] }; Template.api.template_autorun = { id: "template_autorun", - name: "this.autorun(runFunc)", + name: "template.autorun(runFunc)", locus: "Client", descr: ["A version of [Tracker.autorun](#tracker_autorun) that is stopped when the template is destroyed."], args: [ @@ -1828,7 +1828,7 @@ Template.api.template_autorun = { Template.api.template_view = { id: "template_view", - name: "this.view", + name: "template.view", locus: "Client", descr: ["The [View](#ui_view) object for this invocation of the template."] }; diff --git a/docs/client/docs.js b/docs/client/docs.js index 4a99f447d9..22a978d8e4 100644 --- a/docs/client/docs.js +++ b/docs/client/docs.js @@ -248,14 +248,14 @@ var toc = [ {name: "destroyed", id: "template_destroyed"} ], {name: "Template instances", id: "template_inst"}, [ - {instance: "this", name: "findAll", id: "template_findAll"}, - {instance: "this", name: "$", id: "template_findAll"}, - {instance: "this", name: "find", id: "template_find"}, - {instance: "this", name: "firstNode", id: "template_firstNode"}, - {instance: "this", name: "lastNode", id: "template_lastNode"}, - {instance: "this", name: "data", id: "template_data"}, - {instance: "this", name: "autorun", id: "template_autorun"}, - {instance: "this", name: "view", id: "template_view"} + {instance: "template", name: "findAll", id: "template_findAll"}, + {instance: "template", name: "$", id: "template_findAll"}, + {instance: "template", name: "find", id: "template_find"}, + {instance: "template", name: "firstNode", id: "template_firstNode"}, + {instance: "template", name: "lastNode", id: "template_lastNode"}, + {instance: "template", name: "data", id: "template_data"}, + {instance: "template", name: "autorun", id: "template_autorun"}, + {instance: "template", name: "view", id: "template_view"} ], "Template.body", "UI", [