diff options
| author | Fabien Meghazi <fme@openerp.com> | 2012-02-01 13:29:26 +0100 |
|---|---|---|
| committer | Fabien Meghazi <fme@openerp.com> | 2012-02-01 13:29:26 +0100 |
| commit | 0839b0e4eeed05c3f6d69cd5bebec580876ca2bf (patch) | |
| tree | 8db58cc81803f2270835abc1e1bf2d31f9af40b5 /addons/web/static/lib/qweb/qweb2.js | |
| parent | a6be92b62b27e2f775ffd41f6971ff16df8b15e0 (diff) | |
[FIX] QWeb template inheritance done right
bzr revid: fme@openerp.com-20120201122926-poh3q2157ra9tzjd
Diffstat (limited to 'addons/web/static/lib/qweb/qweb2.js')
| -rw-r--r-- | addons/web/static/lib/qweb/qweb2.js | 30 |
1 files changed, 4 insertions, 26 deletions
diff --git a/addons/web/static/lib/qweb/qweb2.js b/addons/web/static/lib/qweb/qweb2.js index 7d58b2492f7..076a658dce9 100644 --- a/addons/web/static/lib/qweb/qweb2.js +++ b/addons/web/static/lib/qweb/qweb2.js @@ -276,10 +276,6 @@ QWeb2.Engine = (function() { if (xDoc.documentElement.nodeName == "parsererror") { return this.tools.exception(xDoc.documentElement.childNodes[0].nodeValue); } - if (xDoc.xml !== undefined) { - // MSIE - return this.convert_xml_to_html(xDoc.documentElement); - } return xDoc; } else { return this.load_xml_string(req.responseText); @@ -307,25 +303,7 @@ QWeb2.Engine = (function() { xDoc.async = false; xDoc.preserveWhiteSpace = true; xDoc.loadXML(s); - return this.convert_xml_to_html(xDoc.documentElement); - }, - convert_xml_to_html: function (node) { - switch (node.nodeType) { - case 3: - case 4: - return document.createTextNode(node.data); - case 8: return document.createComment(node.data); - } - - var hnode = document.createElement(node.nodeName); - for(var i=0, alen=node.attributes.length; i < alen; ++i) { - var attr = node.attributes[i]; - hnode.setAttribute(attr.name, attr.value); - } - for(var j=0, clen=node.childNodes.length; j < clen; ++j) { - hnode.appendChild(this.convert_xml_to_html(node.childNodes[j])); - } - return hnode; + return xDoc; }, has_template : function(template) { return !!this.templates[template]; @@ -431,15 +409,15 @@ QWeb2.Engine = (function() { this.tools.exception(error_msg + "Invalid operation : '" + operation + "'"); } operation = {'replace' : 'replaceWith', 'inner' : 'html'}[operation] || operation; - target[operation](this.jQuery(inner)); + target[operation](child.cloneNode(true)); } else { try { - var f = new Function(['$'], inner); + var f = new Function(['$', 'document'], inner); } catch(error) { return this.tools.exception("Parse " + error_msg + error); } try { - f.apply(target, [this.jQuery]); + f.apply(target, [this.jQuery, template_dest.ownerDocument]); } catch(error) { return this.tools.exception("Runtime " + error_msg + error); } |
