| Package: | CQ.Ext |
| Class: | Template |
| Subclasses: | XTemplate |
| Extends: | Object |
| Clientlib: | cq.widgets |
Represents an HTML fragment template. Templates may be precompiled for greater performance.
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 | |
| Property | Defined By | |
|---|---|---|
|
re : RegExp
See
re. |
Template | |
| Method | Defined By | |
|---|---|---|
Template( Mixed config ) An instance of this class may be created by passing to the constructor either
a single argument, or multiple argument...
An instance of this class may be created by passing to the constructor either
a single argument, or multiple arguments:
Parameters:
|
Template | |
Template.from( String/HTMLElement el, Object config ) : 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:
|
Template | |
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
The ) : 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:
|
Template | |
applyTemplate( Object/Array values
The ) : 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:
|
Template | |
|
compile() : CQ.Ext.Template Compiles the template into an internal function, eliminating the RegEx overhead.
Compiles the template into an internal function, eliminating the RegEx overhead.
Parameters:
|
Template | |
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 | |
set( String html, [Boolean compile] ) : CQ.Ext.Template Sets the HTML used as the template and optionally compiles it.
Sets the HTML used as the template and optionally compiles it.
Parameters:
|
Template | |