The goog.soy.Renderer Class

goog.soy.Renderer(opt_injectedDataSupplier, opt_domHelper)

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.

opt_injectedDataSupplier {goog.soy.InjectedDataSupplier=}
A supplier that provides an injected data.
opt_domHelper {goog.dom.DomHelper=}
Optional DOM helper; defaults to that provided by {@code goog.dom.getDomHelper()}.

.render(template, opt_templateData)

Renders a Soy template and returns the output string.

template {Function}
The Soy template defining the element's content.
opt_templateData {Object=}
The data for the template.
returns {string}
The return value of rendering the template directly.

.renderAsElement(template, opt_templateData)

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. Delegates to {@code goog.soy.renderAsElement}.

template {Function}
The Soy template defining the element's content.
opt_templateData {Object=}
The data for the template.
returns {!Element}
Rendered template contents, wrapped in a parent DIV element if necessary.

.renderAsFragment(template, opt_templateData)

Renders a Soy template into a single node or a document fragment. Delegates to {@code goog.soy.renderAsFragment}.

template {Function}
The Soy template defining the element's content.
opt_templateData {Object=}
The data for the template.
returns {!Node}
The resulting node or document fragment.

.renderElement(element, template, opt_templateData)

Renders a Soy template and then set the output string as the innerHTML of the given element. Delegates to {@code goog.soy.renderElement}.

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