JSFiddle - React, Tailwind, and code Playground
by jaggli
HTML
<!DOCTYPE html>
<html lang="en">
<body>
<!-- bug demonstration for http://bugs.jquery.com/ticket/12411 -->
<div class="area-one">
this should be red
</div>
<div class="area-two">
this should be red
</div>
<div class="area-three">
this should be white
</div>
</body>
</html>
CSS
.area-one,
.area-two,
.area-three{ background: red; }
JavaScript
(function($){
$(function(){
//BUG: undefined removes all classes, instead of none
$(".area-one")
.removeClass(undefined);
//OK: null, empty-string and false all remove no classes, as expected
$(".area-two")
.removeClass(null)
.removeClass("")
.removeClass(false);
//OK: empty call removes all classes
// as expected http://api.jquery.com/removeClass/
$(".area-three")
.removeClass();
});
}(window.jQuery));