Don't set button text when reusing existing button elements

Since changeset 4744202e7c6a button elements are reused, so we must
only add its text when it does not exist otherwise the label is shown
multiple times.
issue5870

review32571002
This commit is contained in:
Sergi Almacellas Abellana
2016-09-13 10:24:42 +02:00
parent d6b3ae4ba0
commit 37d91cb526
+2 -2
View File
@@ -720,17 +720,17 @@
this.el = el;
} else {
this.el = jQuery('<button/>');
this.el.append(attributes.string || '');
}
this.icon = this.el.children('img');
if (!this.icon.length) {
this.icon = jQuery('<img/>').appendTo(this.el);
this.icon = jQuery('<img/>').prependTo(this.el);
this.icon.hide();
}
this.el.addClass('btn btn-default');
this.el.attr('type', 'button');
this.icon.addClass('icon');
this.icon.attr('aria-hidden', true);
this.el.append(attributes.string || '');
this.set_icon(attributes.icon);
},
set_icon: function(icon_name) {