Call the template instance template, not this

But keep some occurrences of `this` for clarity; for example, “in a rendered callback you can use `this.findAll`”.
This commit is contained in:
David Greenspan
2014-08-28 00:53:22 -07:00
parent d951e45a1b
commit cecf89516e
3 changed files with 20 additions and 20 deletions

View File

@@ -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

View File

@@ -1771,7 +1771,7 @@ Template.api.template_helpers = {
Template.api.template_findAll = {
id: "template_findAll",
name: "<em>this</em>.findAll(selector) and <em>this</em>.$(selector)",
name: "<em>template</em>.findAll(selector) and <em>template</em>.$(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: "<em>this</em>.find(selector)",
name: "<em>template</em>.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: "<em>this</em>.firstNode",
name: "<em>template</em>.firstNode",
locus: "Client",
descr: ["The first top-level DOM node in this template instance."]
};
Template.api.template_lastNode = {
id: "template_lastNode",
name: "<em>this</em>.lastNode",
name: "<em>template</em>.lastNode",
locus: "Client",
descr: ["The last top-level DOM node in this template instance."]
};
Template.api.template_data = {
id: "template_data",
name: "<em>this</em>.data",
name: "<em>template</em>.data",
locus: "Client",
descr: ["The data context of this instance's latest invocation."]
};
Template.api.template_autorun = {
id: "template_autorun",
name: "<em>this</em>.autorun(runFunc)",
name: "<em>template</em>.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: "<em>this</em>.view",
name: "<em>template</em>.view",
locus: "Client",
descr: ["The [View](#ui_view) object for this invocation of the template."]
};

View File

@@ -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", [