Avoid to wrap element into div for InputCompletion

The div is only needed if it receive an input element otherwise the element can
receive the dropdown class. This avoid to increase the DOM depth and keep the
original display of the element.
This commit is contained in:
Cédric Krier committed 2015-10-02 14:32:53 +02:00
1 parent 6cfe22250b
commit db5372477e
1 file changed
+7 -2
+7 -2
View File
@@ -2937,8 +2937,13 @@
Sao.common.InputCompletion = Sao.class_(Object, {
init: function(el, source, match_selected, format) {
el.wrap('<div class="dropdown"/>');
this.dropdown = el.parent();
if (!el.is('input')) {
el.addClass('dropdown');
this.dropdown = el;
} else {
el.wrap('<div class="dropdown"/>');
this.dropdown = el.parent();
}
this.input = el.find('input').add(el.filter('input')).first();
// bootstrap requires an element with data-toggle
jQuery('<span/>', {