[FIX] Do not insert Elements instead of HTMLElements in the dom

bzr revid: fme@openerp.com-20121205105933-y3glnms4dnk7k2uz
This commit is contained in:
Fabien Meghazi 2012-12-05 11:59:33 +01:00
parent 595ba7a799
commit 8d9367a873
1 changed files with 16 additions and 1 deletions

View File

@ -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;