Module used for template rendering
- Source:
Example
Application.require('js-template').then(function (jsTemplate) {
jsTemplate.parseContent(
document.body,
function (err, config) { console.log(config) },
{ context: {}, args: { item: 'sample reference' }}
);
}, console.error);
Returns:
Members
(inner) node :HTMLSelectElement
- Source:
Type:
- HTMLSelectElement
(inner) node :HTMLTextAreaElement
- Source:
Type:
- HTMLTextAreaElement
(inner) node :HTMLInputElement
- Source:
Type:
- HTMLInputElement
(inner) text :string
- Source:
Type:
- string
Methods
(inner) attrParser(attr) → {module:js-template~jsTemplate_attrResult}
- Source:
Parsing NodeElement Attribute
Parameters:
Name | Type | Description |
---|---|---|
attr |
module:js-template~jsTemplate_Attribute |
Returns:
(inner) expressionBuilder(code, config)
- Source:
Expression Builder
Parameters:
Name | Type | Description |
---|---|---|
code |
string | |
config |
module:js-template~parseTextNodesConfig |
(inner) nodeParser(nodeElement, cb, config) → {module:js-template~parseTextNodesConfig}
- Source:
Parameters:
Name | Type | Description |
---|---|---|
nodeElement |
HTMLElement | |
cb |
module:js-template.nodeParserCallback | |
config |
module:js-template~parseTextNodesConfig |
Returns:
(inner) parseTextNodes(textNode, cb, config)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
textNode |
HTMLElement | Node | Text | |
cb |
module:js-template.parseTextNodesCallback | |
config |
module:js-template~parseTextNodesConfig |
Type Definitions
JSTemplateModule
- Source:
Properties:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
parseContent |
module:js-template~nodeParser | ||||||||||||||||
config |
object |
Properties
|
Type:
- Object
(protected) nodeParserCallback(err, config) → {module:js-template~parseTextNodesConfig}
- Source:
Parameters:
Name | Type | Description |
---|---|---|
err |
Error | |
config |
module:js-template~parseTextNodesConfig |
Returns:
jsTemplate_Attribute
- Source:
Properties:
Name | Type | Description |
---|---|---|
name |
String | |
value |
String |
Type:
- Object
jsTemplate_attrResult
- Source:
Properties:
Name | Type | Description |
---|---|---|
type |
'event' | 'attribute' | 'binding' | 'macro' | |
attr |
module:js-template~jsTemplate_Attribute | |
data |
module:js-template~jsTemplate_attrResultAttributeData |
Type:
- Object
jsTemplate_attrResultAttributeData
- Source:
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
name |
String | attribute name |
||
code |
String | executable code |
||
node |
HTMLElement | node element |
||
buffer |
any |
<optional> |
( technical property ) |
|
inline |
Boolean |
<optional> |
false
|
should be value be parsed |
postProcess |
Boolean |
<optional> |
false
|
should be value be parsed |
Type:
- Object
jsTemplate_textResult
- Source:
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
type |
string |
<optional> |
'text'
|
|
data |
module:js-template~jsTemplate_textResultData |
Type:
- Object
jsTemplate_textResultData
- Source:
Properties:
Name | Type | Description |
---|---|---|
nodes |
Array.<Text> | |
initialNodes |
Array.<Text> | |
code |
String |
Type:
- Object
jsTemplateAttrData
- Source:
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
nodes |
Array.<module:js-template~jsTemplate_attrResult> | |||
texts |
Array.<module:js-template~jsTemplate_textResult> | |||
children |
Array.<module:js-template~jsTemplateAttrData> | |||
_macro |
Object.<string, module:js-template~jsTemplate_attrResult> | |||
HAS_POST_PROCESS |
boolean |
<optional> |
false
|
Type:
- Object
parseTextNodesCallback(err, config)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
err |
Error | |
config |
module:js-template~parseTextNodesConfig |
parseTextNodesConfig
- Source:
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
args |
object |
<optional> |
{}
|
arguments |
context |
object |
<optional> |
{}
|
execution context |
start |
String |
<optional> |
'{{'
|
start token |
end |
String |
<optional> |
'}}'
|
end token |
textNodes |
Array.<module:js-template~jsTemplate_textResult> |
<optional> |
array of TextNodes |
|
buffer |
Array.<Text> |
<optional> |
(technical property) buffer |
|
opened |
boolean |
<optional> |
false
|
(technical property) |
__argsNames |
Array.<string> |
<optional> |
(technical property) |
|
__argsValues |
Array.<any> |
<optional> |
(technical property) |
Type:
- Object