From 2cbb2fe36c778a1660ecf10a63a6e0c940736642 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Wed, 22 Jun 2011 16:38:05 +0200 Subject: [PATCH] [IMP] QWeb2 t-js now handles more than one child bzr revid: fme@openerp.com-20110622143805-qryluomj7w4l3s5m --- addons/base/static/lib/qweb/qweb2.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/addons/base/static/lib/qweb/qweb2.js b/addons/base/static/lib/qweb/qweb2.js index 5e53ddbf645..e617df60183 100644 --- a/addons/base/static/lib/qweb/qweb2.js +++ b/addons/base/static/lib/qweb/qweb2.js @@ -670,15 +670,10 @@ QWeb2.Element = (function() { this.top("(function(" + value + ") {"); this.bottom("})(dict);"); this.indent(); - if (this.children.length === 1) { - var lines = this.children[0].node.data.split(/\r?\n/); - for (var i = 0, ilen = lines.length; i < ilen; i++) { - this.top(lines[i]); - } - } else { - this.engine.tools.exception("'js' code block contains " + this.children.length + " nodes instead of 1"); + var lines = this.engine.tools.xml_node_to_string(this.node, true).split(/\r?\n/); + for (var i = 0, ilen = lines.length; i < ilen; i++) { + this.top(lines[i]); } - // Maybe I could handle the children ? this.process_children = false; }, compile_action_debug : function(value) {