diff options
| author | Fabien Meghazi <fme@openerp.com> | 2012-12-05 11:59:33 +0100 |
|---|---|---|
| committer | Fabien Meghazi <fme@openerp.com> | 2012-12-05 11:59:33 +0100 |
| commit | 8d9367a8733e8bf83e0d77fd9aa5cdaf19c93387 (patch) | |
| tree | 531c78388f63d77c092a7396b4fe01a9ff84446d /addons/web/static/src/js | |
| parent | 595ba7a79959d66c2c3a819e44770084a1a053e3 (diff) | |
[FIX] Do not insert Elements instead of HTMLElements in the dom
bzr revid: fme@openerp.com-20121205105933-y3glnms4dnk7k2uz
Diffstat (limited to 'addons/web/static/src/js')
| -rw-r--r-- | addons/web/static/src/js/view_form.js | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 31fadc789d4..6b6cbb3b58a 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -1190,12 +1190,27 @@ instance.web.form.FormRenderingEngine = instance.web.form.FormRenderingEngineInt } }, get_arch_fragment: function() { + function removeWhiteSpacesNodes(node) { + switch (node.nodeType) { + case 3: + case 4: + if (node.data.trim() === '') { + node.parentElement.removeChild(node); + } + break; + case 1: + for (var i = node.childNodes.length - 1; i >= 0; i--) { + removeWhiteSpacesNodes(node.childNodes[i]); + } + } + } var doc = this.fvg.arch_doc.documentElement.cloneNode(true); // IE won't allow custom button@type and will revert it to spec default : 'submit' $('button', doc).each(function() { $(this).attr('data-button-type', $(this).attr('type')).attr('type', 'button'); }); - return $('<div class="oe_form"/>').append(doc); + removeWhiteSpacesNodes(doc); + return $('<div class="oe_form"/>').append(instance.web.xml_to_str(doc)); }, render_to: function($target) { var self = this; |
