Is there a library that already performs this function? I've only been able to find online tools. The reason I am interested in accomplishing this task using JavaScript is because I need to ensure that the strings a > b, a
and a> b,a
are considered identical. If I can compress them as CSS, all versions will result in the same string.
To provide further context for my goal: I developed a jQuery plugin for personal use to cache jQuery selectors (like this example$('div')
). This plugin functions by storing a key-value pair where the key represents my selector string and the value consists of the corresponding DOM elements. That's why I aim to compare CSS selector strings – to avoid storing distinct keys for essentially the same selector.