[FIX] web_editor: clean_for_save all dirty options

Clean for save was only called on o_dirty nodes but o_dirty is added only on o_editable nodes.
Could use a simple jQuery selector '.o_dirty, .o_dirty *' but need to improve speed for user experience.
This commit is contained in:
Christophe Matthieu
2015-08-26 16:01:18 +02:00
committed by David Monjoie
parent ea26a62712
commit 8eb8a982f9
@@ -507,7 +507,13 @@ var BuildingBlock = Widget.extend({
for (var k in template) {
var Option = opt[template[k]['option']];
if (Option && Option.prototype.clean_for_save !== dummy) {
template[k].selector.all().filter(".o_dirty").each(function () {
template[k].selector.all().filter(function () {
var node = this;
while (!/o_dirty|o_editable/.test(node.className) && node !== document) {
node = node.parentNode;
}
return node.className.indexOf("o_dirty") !== -1;
}).each(function () {
new Option(self, null, $(this), k).clean_for_save();
});
}