JSFiddle - React, Tailwind, and code Playground

by jfriend00

HTML

<div class="a b c d" id="fun">Some text</div>
<span class="foo fee fun">More text</span>

CSS

.abcd {color: red;} 
.foofeefun {color: blue;}
.feefoofun {color: green;}

JavaScript

$(document).ready(function() {
    var classList = {};
    $("*").each(function() {
        var temp;
        if (this.className) {
            temp = this.className.split(" ");
            temp.sort();  // put in predictable order
            this.className = temp.join("");
            classList[this.className] = true;
        }
    });
});