TemplateXTemplate
| Package: | CQ.Ext |
| Class: | XTemplate |
| Extends: | CQ.Ext.Template |
| Clientlib: | cq.widgets |
A template class that supports advanced functionality like:
XTemplate provides the templating mechanism built into:
For example usage see the constructor.
| Config Options | Defined By | |
|---|---|---|
|
compiled : Boolean Specify true to compile the template immediately (see compile). Defaults to false.
Specify true to compile the template immediately (see
compile). Defaults to false. |
Template | |
|
re : RegExp The regular expression used to match template variables. Defaults to:re : /\{([\w\-]+)\}/g ...
The regular expression used to match template variables. Defaults to:
|
Template | |
| Method | Defined By | |
|---|---|---|
XTemplate( Mixed config ) The CQ.Ext.Template constructor describes
the acceptable parameters to pass to the constructor. The following
example...
The CQ.Ext.Template constructor describes
the acceptable parameters to pass to the constructor. The following
examples demonstrate all of the supported features.
Parameters:
|
XTemplate | |
XTemplate.from( String/HTMLElement el ) : CQ.Ext.Template <static> Creates a template from the passed element's value (display:none textarea, preferred) or innerHTML.
<static> Creates a template from the passed element's value (display:none textarea, preferred) or innerHTML.
Parameters:
|
XTemplate | |
append( Mixed el, Object/Array values
The, [Boolean returnElement] ) : HTMLElement/CQ.Ext.Element Applies the supplied values to the template and appends
the new node(s) to the specified el.
For example usage see th...
Applies the supplied
values to the template and appends
the new node(s) to the specified el.
For example usage see the constructor.
Parameters:
|
Template | |
apply( Object/Array values ) : String Alias for applyTemplate
Returns an HTML fragment of this template with the specified values applied.
Alias for applyTemplate
Returns an HTML fragment of this template with the specified values applied.
Parameters:
|
XTemplate | |
applyTemplate( Object values ) : String Returns an HTML fragment of this template with the specified values applied.
Returns an HTML fragment of this template with the specified values applied.
Parameters:
|
XTemplate | |
|
compile() : Function Compile the template to a function for optimized performance. Recommended if the template will be used frequently.
Compile the template to a function for optimized performance. Recommended if the template will be used frequently.
Parameters:
|
XTemplate | |
insertAfter( Mixed el, Object/Array values, [Boolean returnElement] ) : HTMLElement/CQ.Ext.Element Applies the supplied values to the template and inserts the new node(s) after el.
Applies the supplied values to the template and inserts the new node(s) after el.
Parameters:
|
Template | |
insertBefore( Mixed el, Object/Array values, [Boolean returnElement] ) : HTMLElement/CQ.Ext.Element Applies the supplied values to the template and inserts the new node(s) before el.
Applies the supplied values to the template and inserts the new node(s) before el.
Parameters:
|
Template | |
insertFirst( Mixed el, Object/Array values, [Boolean returnElement] ) : HTMLElement/CQ.Ext.Element Applies the supplied values to the template and inserts the new node(s) as the first child of el.
Applies the supplied values to the template and inserts the new node(s) as the first child of el.
Parameters:
|
Template | |
overwrite( Mixed el, Object/Array values, [Boolean returnElement] ) : HTMLElement/CQ.Ext.Element Applies the supplied values to the template and overwrites the content of el with the new node(s).
Applies the supplied values to the template and overwrites the content of el with the new node(s).
Parameters:
|
Template | |