The goog.soy Namespace

The goog.soy.InjectedDataSupplier Interface

An interface for a supplier that provides Soy injected data. @interface … more

The goog.soy.Renderer Class

Creates a new soy renderer. Note that the renderer will only be guaranteed to work correctly within the document scope provided in the DOM helper. … more

.renderAsElement(template, opt_templateData, opt_injectedData, opt_domHelper)

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.

template {Function}
The Soy template defining the element's content.
opt_templateData {Object=}
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 {@code goog.dom.getDomHelper}.
returns {!Element}
Rendered template contents, wrapped in a parent DIV element if necessary.

.renderAsFragment(template, opt_templateData, opt_injectedData, opt_domHelper)

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.

template {Function}
The Soy template defining the element's content.
opt_templateData {Object=}
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 {@code goog.dom.getDomHelper}.
returns {!Node}
The resulting node or document fragment.

.renderElement(element, template, opt_templateData, opt_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.

element {Element}
The element whose content we are rendering into.
template {Function}
The Soy template defining the element's content.
opt_templateData {Object=}
The data for the template.
opt_injectedData {Object=}
The injected data for the template.

.testHelper