summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/framework/widget.js
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2015-07-16 15:24:02 +0200
committerAaron Bohy <aab@odoo.com>2015-07-17 09:53:30 +0200
commit16eb36ff45bec31cfb98865b739c34e0a513a02f (patch)
treecebe52ba39aacb0f924f8ce447f9827239adb9a9 /addons/web/static/src/js/framework/widget.js
parentc22d75bdc541919a1dc861645d1e0306ab62be9c (diff)
[IMP] web: use a classname to show/hide widgets
The problem of $el.show()/hide() is that calling show() on a jQuery element on which there is no display rule in the stylesheet automatically sets 'display: block'. However, when a jQuery element is not yet in the DOM, the rules defined on it are not yet applied, meaning that calling show() will set its display to block (in inline style), even if there is different a css rule (e.g. 'dislay: flex'). As the inline style takes the priority over the stylesheet, the correct display won't be applied, even when the widget will be appended in the DOM, resulting in a possibly broken layout.
Diffstat (limited to 'addons/web/static/src/js/framework/widget.js')
-rw-r--r--addons/web/static/src/js/framework/widget.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/web/static/src/js/framework/widget.js b/addons/web/static/src/js/framework/widget.js
index 199568b727f..70f48caa261 100644
--- a/addons/web/static/src/js/framework/widget.js
+++ b/addons/web/static/src/js/framework/widget.js
@@ -347,10 +347,10 @@ var Widget = core.Class.extend(mixins.PropertiesMixin, {
return this.$el.find(selector);
},
do_show: function () {
- this.$el.show();
+ this.$el.removeClass('o_hidden');
},
do_hide: function () {
- this.$el.hide();
+ this.$el.addClass('o_hidden');
},
/**
* Proxies a method of the object, in order to keep the right ``this`` on