This is a JavaScript library for escaping text for use in CSS strings or identifiers while generating the shortest possible valid ASCII-only output. Here’s an online demo.
This makes it easy to extract data embedded in JavaScript code using XPath in a way more robust than just using regular expressions. Use calmjs.parse instead of slimit for JavaScript parsing ...