apply a click handler with vanilla js instead of jquery

the jquery method only worked ~50% of the time in Firefox 90
for a completely unknown reason
pull/1/head
ansuz 3 years ago
parent 7f41f8765e
commit 6413be24f3

@ -919,10 +919,13 @@ define([
}, [
h('i.fa.' + icon),
h('span.cp-toolbar-name'+drawerCls, data.text)
])).click(common.prepareFeedback(data.name || 'DEFAULT'));
if (callback) {
button.click(callback);
}
]));
var feedbackHandler = common.prepareFeedback(data.name || 'DEFAULT');
button[0].addEventListener('click', function () {
feedbackHandler();
if (typeof(callback) !== 'function') { return; }
callback();
});
if (data.style) { button.attr('style', data.style); }
if (data.id) { button.attr('id', data.id); }
if (data.hiddenReadOnly) { button.addClass('cp-hidden-if-readonly'); }

Loading…
Cancel
Save