I can scrape a string that's made of HTML, and pull out a list of classes that are assigned to elements in that string. But can you guys suggest a way that I might determine whether that class actually exists in MY CSS?
This is still with a contenteditable... users copy and paste something from another site and it brings over class names that aren't defined on my end. It doesn't break anything, but it's just a waste of space.
I thought about doing this in PHP by actually reading the CSS file, make an array of the classes, and then removing the ones that don't exist. But I'd rather do it client-side so that the user sees the finished product before they submit.
I'm using jQuery 3.3.1 if that helps.