Reputation: 2003
How can I force ui-btn-active
never to be set anywhere? Listening for events seems very bloaty since I don't really know where it is applied.
Searching online I only found very outdated solutions.
Upvotes: 0
Views: 34
Reputation: 514
You can remove the class in JS on mobileinit
$(document).on("mobileinit", function () {
$.mobile.activeBtnClass = "";
});
Upvotes: 2
Reputation: 47099
Partly an answer..
You could overwrite the original $.fn.addClass
method and remove the className before calling the original addClass:
var _org = $.fn.addClass;
$.fn.addClass = function(className) {
className = className.replace(/\bui-btn-active\b/g, '');
return _org.call(this, className);
}
This will not protect you against:
el.className = 'ui-btn-active';
$(el).html('<div class="ui-btn-active"></div>');
el.classList.add('ui-btn-active');
el.innerHTML = '<div class="ui-btn-active"></div>';
Upvotes: 0