Confirming that [filter] won't blow up
Based on comment http://stackoverflow.com/questions/2644299/jquery-removeclass-wildcard/2644364#comment28170566_2644364
by drzaus
HTML
<p>I have no class</p>
<p class>My class is not half-full</p>
<p class="">I may have class but it's an empty gesture</p>
<p class="some">You've got some class</p>
<p class="ghosted" id="ghosted">I had class but now I forgot...</p>
<p class="ghosted" id="killed">I had class but now I--URK!</p>
<p class="ghosted" id="propped">Where's my wooden leg?</p>
<div id="output"></div>
CSS
pre { margin:0; padding:0; }
#output { border-top:2px solid black; }
JavaScript
(function($) {
// #region ============== debug stuff ===================
var $output = document.getElementById('output');
var log = function() {
var args = Array.prototype.slice.call(arguments, 0);
$.each(args, function(k,v) {
if(console && console.log) console.log(k,v);
$output.innerHTML += '<pre>' + k + ': ' + JSON.stringify(v) + '</pre>';
});
}
// #endregion ============== debug stuff ===================
// #region ============== the test ===================
$(function() {
$('#ghosted').removeClass('ghosted');
$('#killed').removeAttr('class');
$('#propped').removeProp('class');
$('p[class]').each(function(i,v) {
log(i,$(v).text());
});
});
// #endregion ============== the test ===================
})(jQuery);