derby-parsing
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -286,3 +286,3 @@ var htmlUtil = require('html-util'); | ||
var remaining = element.content || []; | ||
var viewInstance = new templates.DynamicViewInstance(nameAttribute.expression, viewAttributes, hooks); | ||
var viewInstance = createDynamicViewInstance(nameAttribute.expression, viewAttributes, hooks); | ||
finishParseViewElement(viewAttributes, remaining, viewInstance); | ||
@@ -313,2 +313,9 @@ } else { | ||
function createDynamicViewInstance(expression, attributes, hooks) { | ||
var viewInstance = new templates.DynamicViewInstance(expression, attributes, hooks); | ||
// Wrap the viewInstance in a block with the same expression, so that it is | ||
// re-rendered when any of its dependencies change | ||
return new templates.Block(expression, [viewInstance]); | ||
} | ||
function finishParseViewElement(viewAttributes, remaining, viewInstance) { | ||
@@ -460,3 +467,3 @@ if (!viewAttributes.hasOwnProperty('content') && remaining.length) { | ||
} else { | ||
viewInstance = new templates.DynamicViewInstance(nameExpression, hooks, viewAttributes); | ||
viewInstance = createDynamicViewInstance(nameExpression, viewAttributes, hooks); | ||
} | ||
@@ -463,0 +470,0 @@ parseNode.content.push(viewInstance); |
{ | ||
"name": "derby-parsing", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "Add HTML template parsing to Derby", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
71740
1842