marko/compiler/ast/Text/vdom/generateCode.js
Patrick Steele-Idem e76c7fa6d6 vdom support
2016-09-19 16:50:44 -06:00

16 lines
456 B
JavaScript

'use strict';
var TextVDOM = require('./TextVDOM');
var Literal = require('../../Literal');
module.exports = function(node, codegen, vdomUtil) {
var argument = codegen.generateCode(node.argument);
if (argument instanceof Literal && argument.value === '') {
// Don't add empty text nodes to the final tree
return null;
}
var isStatic = vdomUtil.isStaticValue(argument);
return new TextVDOM({ argument, isStatic });
};