soy.Renderer Extends
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.

Inheritance

Constructor

goog.soy.Renderer(opt_injectedDataSupplieropt_domHelper)

Parameters

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 goog.dom.getDomHelper().

Instance Methods

Public Protected Private
getInjectedData_() Object
Creates the injectedParams map if necessary and calls the configuration service to prepopulate it.
Returns: Object  The injected params.
code »
getSavedTemplateRenders() !goog.soy.Renderer.SavedTemplateRender
No description.
Returns: !goog.soy.Renderer.SavedTemplateRender  Saved template data for the renders that have happened so far.
code »
handleRender(opt_node)
Observes rendering of templates by this renderer.
Arguments:
opt_node : Node=
Relevant node, if available. The node may or may not be in the document, depending on whether Soy is creating an element or writing into an existing one.
code »
render(templateopt_templateData) string
Renders a Soy template and returns the output string. If the template is strict, it must be of kind HTML. To render strict templates of other kinds, use renderText (for kind="text") or renderStrict.
Arguments:
template : null | function(ARG_TYPES, null=, Object.<string, *>=):>
The Soy template to render.
opt_templateData : ARG_TYPES=
The data for the template.
Returns: string  The return value of rendering the template directly.
code »
renderAsElement(templateopt_templateData) !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. Delegates to goog.soy.renderAsElement.
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.
Returns: !Element  Rendered template contents, wrapped in a parent DIV element if necessary.
code »
renderAsFragment(templateopt_templateData) !Node
Renders a Soy template into a single node or a document fragment. Delegates to goog.soy.renderAsFragment.
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.
Returns: !Node  The resulting node or document fragment.
code »
renderElement(elementtemplateopt_templateData)
Renders a Soy template and then set the output string as the innerHTML of the given element. Delegates to goog.soy.renderElement.
Arguments:
element : Element
The element whose content we are rendering.
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.
code »
renderSafeHtml(templateopt_templateData) !goog.html.SafeHtml
Renders a strict Soy template of kind="html" and returns the result as a goog.html.SafeHtml object. Rendering a template that is not a strict template of kind="html" results in a runtime error.
Arguments:
template : null | function(ARG_TYPES, null=, Object.<string, *>=): goog.soy.data.SanitizedConten>
The Soy template to render.
opt_templateData : ARG_TYPES=
The data for the template.
Returns: !goog.html.SafeHtml  No description.
code »
renderStrict(templateopt_templateDataopt_kind) RETURN_TYPE
Renders a strict Soy template and returns the output SanitizedContent object.
Arguments:
template : null | function(ARG_TYPES, null=, Object.<string, *>=):RETURN_TYP>
The Soy template to render.
opt_templateData : ARG_TYPES=
The data for the template.
opt_kind : goog.soy.data.SanitizedContentKind=
The output kind to assert. If null, the template must be of kind="html" (i.e., opt_kind defaults to goog.soy.data.SanitizedContentKind.HTML).
Returns: RETURN_TYPE  The SanitizedContent object. This return type is generic based on the return type of the template, such as soy.SanitizedHtml.
code »
renderText(templateopt_templateData) string
Renders a strict Soy template of kind="text" and returns the output string. It is an error to use renderText on non-strict templates, or strict templates of kinds other than "text".
Arguments:
template : null | function(ARG_TYPES, null=, Object.<string, *>=): goog.soy.data.SanitizedConten>
The Soy template to render.
opt_templateData : ARG_TYPES=
The data for the template.
Returns: string  The return value of rendering the template directly.
code »
saveTemplateRender_(templateopt_templateData)
Saves information about the current template render for debug purposes.
Arguments:
template : Function
The Soy template defining the element's content.
opt_templateData : Object=
The data for the template.
code »

Instance Properties

No description.
Code »
savedTemplateRenders_ :
Map from template name to the data used to render that template.
Code »
No description.
Code »

Static Properties

goog.soy.Renderer.SavedTemplateRender :
No description.
Code »

Package soy

Package Reference