- htmlSnippet is the snippet you want to sanitize
- nameIdClassTransformer is a function which is called on every id, name and class in htmlSnippet
The return value is the html snippet with all script and style tags removed, and urls, ids, names and classes rewritten according to the transformers.
If you need more control, you can use html.makeSaxParser to create your own SAX style processor. makeSaxParser takes as its argument, an object that contains event handlers like:
After this call, mySaxParser is a function that takes HTML text and an arbitrary value that will be passed as the parameter x to the event handlers above.