|
@@ -19,7 +19,7 @@ export default class Template {
|
|
|
/**
|
|
/**
|
|
|
* Creates an instance of the {@link Template} class.
|
|
* Creates an instance of the {@link Template} class.
|
|
|
*
|
|
*
|
|
|
- * @param {TemplateDefinition} def The definition of the template.
|
|
|
|
|
|
|
+ * @param {TemplateDefinition} definition The definition of the template.
|
|
|
* @constructor
|
|
* @constructor
|
|
|
*/
|
|
*/
|
|
|
constructor( def ) {
|
|
constructor( def ) {
|
|
@@ -28,16 +28,16 @@ export default class Template {
|
|
|
*
|
|
*
|
|
|
* @property {TemplateDefinition}
|
|
* @property {TemplateDefinition}
|
|
|
*/
|
|
*/
|
|
|
- this.def = def;
|
|
|
|
|
|
|
+ this.definition = def;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * Renders DOM Node using {@link #def}.
|
|
|
|
|
|
|
+ * Renders DOM Node using {@link #definition}.
|
|
|
*
|
|
*
|
|
|
* @returns {HTMLElement}
|
|
* @returns {HTMLElement}
|
|
|
*/
|
|
*/
|
|
|
render() {
|
|
render() {
|
|
|
- return this._renderNode( this.def, true );
|
|
|
|
|
|
|
+ return this._renderNode( this.definition, true );
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -146,8 +146,8 @@ export default class Template {
|
|
|
_renderElementAttributes( def, el ) {
|
|
_renderElementAttributes( def, el ) {
|
|
|
let attr, value;
|
|
let attr, value;
|
|
|
|
|
|
|
|
- for ( attr in def.attrs ) {
|
|
|
|
|
- value = def.attrs[ attr ];
|
|
|
|
|
|
|
+ for ( attr in def.attributes ) {
|
|
|
|
|
+ value = def.attributes[ attr ];
|
|
|
|
|
|
|
|
// Attribute bound directly to the model.
|
|
// Attribute bound directly to the model.
|
|
|
if ( typeof value == 'function' ) {
|
|
if ( typeof value == 'function' ) {
|
|
@@ -245,7 +245,7 @@ function getAttributeUpdater( attr ) {
|
|
|
* children: [
|
|
* children: [
|
|
|
* {
|
|
* {
|
|
|
* tag: 'span',
|
|
* tag: 'span',
|
|
|
- * attrs: { ... },
|
|
|
|
|
|
|
+ * attributes: { ... },
|
|
|
* children: [ ... ],
|
|
* children: [ ... ],
|
|
|
* ...
|
|
* ...
|
|
|
* },
|
|
* },
|
|
@@ -255,7 +255,7 @@ function getAttributeUpdater( attr ) {
|
|
|
* 'def',
|
|
* 'def',
|
|
|
* ...
|
|
* ...
|
|
|
* ],
|
|
* ],
|
|
|
- * attrs: {
|
|
|
|
|
|
|
+ * attributes: {
|
|
|
* 'class': [ 'a', 'b' ],
|
|
* 'class': [ 'a', 'b' ],
|
|
|
* id: 'c',
|
|
* id: 'c',
|
|
|
* style: callback,
|
|
* style: callback,
|
|
@@ -274,7 +274,7 @@ function getAttributeUpdater( attr ) {
|
|
|
* @type Object
|
|
* @type Object
|
|
|
* @property {String} tag
|
|
* @property {String} tag
|
|
|
* @property {Array} [children]
|
|
* @property {Array} [children]
|
|
|
- * @property {Object} [attrs]
|
|
|
|
|
|
|
+ * @property {Object} [attributes]
|
|
|
* @property {String} [text]
|
|
* @property {String} [text]
|
|
|
* @property {Object} [on]
|
|
* @property {Object} [on]
|
|
|
*/
|
|
*/
|