can.view.txt
A helper function used to insert the value of the contents of a magic tag into a template's output. It detects if an observable value is read and will setup live binding.
can.view.txt(escape, tagName, status, self, func)
Parameters
-
1
{Number}
if the content returned should be escaped, 0 if otherwise.
-
tagName
{String}
the name of the tag the magic tag is most immediately within. Ex:
"li"
. -
status
{String | Number}
A flag indicates which part of a tag the magic tag is within. Status can be:
- STRING - The name of the attribute the magic tag is within. Ex:
"class"
1
- The magic tag is within a tag like<div <%= %>>
0
- The magic tag is outside (or between) tags like<div><%= %></div>
- STRING - The name of the attribute the magic tag is within. Ex:
-
self
{*}
The
this
of the current context template.func
is called with self as this. -
func
{function()}
The "wrapping" function. For example:
<%= task.attr('name') %>
becomes `(function(){return task.attr('name')})