soy.js
No description.

File Location

/goog/soy/soy.js


Public Protected Private

Enumerations

Global Functions

goog.soy.assertFirstTagValid_(html)
Checks that the rendered HTML does not start with an invalid tag that would likely cause unexpected output from renderAsElement or renderAsFragment. See http://www.w3.org/TR/html5/semantics.html#semantics for reference as to which HTML elements can be parents of each other.
Arguments:
html : string
The output of a template.
code »
goog.soy.ensureTemplateOutputHtml_(templateResult) string
Ensures the result is "safe" to insert as HTML. Note if the template has non-strict autoescape, the guarantees here are very weak. It is recommended applications switch to requiring strict autoescaping over time by tweaking goog.soy.REQUIRE_STRICT_AUTOESCAPE. In the case the argument is a SanitizedContent object, it either must already be of kind HTML, or if it is kind="text", the output will be HTML escaped.
Arguments:
templateResult : *
The template result.
Returns: string  The assumed-safe HTML output string.
code »
goog.soy.renderAsElement(templateopt_templateDataopt_injectedDataopt_domHelper) !Element
Renders a Soy template into a single node. If the rendered HTML string represents a single node, then that node is returned. Otherwise, a DIV element is returned containing the rendered nodes.
Arguments:
template : null | function(ARG_TYPES, null=, Object.<string, *>=):>
The Soy template defining the element's content.
opt_templateData : ARG_TYPES=
The data for the template.
opt_injectedData : Object=
The injected data for the template.
opt_domHelper : goog.dom.DomHelper=
The DOM helper used to create DOM nodes; defaults to goog.dom.getDomHelper.
Returns: !Element  Rendered template contents, wrapped in a parent DIV element if necessary.
code »
goog.soy.renderAsFragment(templateopt_templateDataopt_injectedDataopt_domHelper) !Node
Renders a Soy template into a single node or a document fragment. If the rendered HTML string represents a single node, then that node is returned (note that this is *not* a fragment, despite them name of the method). Otherwise a document fragment is returned containing the rendered nodes.
Arguments:
template : null | function(ARG_TYPES, null=, Object.<string, *>=):>
The Soy template defining the element's content.
opt_templateData : ARG_TYPES=
The data for the template.
opt_injectedData : Object=
The injected data for the template.
opt_domHelper : goog.dom.DomHelper=
The DOM helper used to create DOM nodes; defaults to goog.dom.getDomHelper.
Returns: !Node  The resulting node or document fragment.
code »
goog.soy.renderElement(elementtemplateopt_templateDataopt_injectedData)
Renders a Soy template and then set the output string as the innerHTML of an element. It is recommended to use this helper function instead of directly setting innerHTML in your hand-written code, so that it will be easier to audit the code for cross-site scripting vulnerabilities.
Arguments:
element : Element
The element whose content we are rendering into.
template : null | function(ARG_TYPES, null=, Object.<string, *>=):>
The Soy template defining the element's content.
opt_templateData : ARG_TYPES=
The data for the template.
opt_injectedData : Object=
The injected data for the template.
code »

Directory soy

File Reference