can.view.txt

  • function
 

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. 1 {Number}

    if the content returned should be escaped, 0 if otherwise.

  2. tagName {String}

    the name of the tag the magic tag is most immediately within. Ex: "li".

  3. 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>
  4. self {*}

    The this of the current context template. func is called with self as this.

  5. func {function()}

    The "wrapping" function. For example: <%= task.attr('name') %> becomes `(function(){return task.attr('name')})