Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

what does sanitize do javascript

// our input string to clean
const stringToClean = 'Some text <b><i>with</i></b> <blink>tags</blink>, including a rogue script <script>alert(1)</script> def.';

const result = new Sanitizer().sanitize(stringToClean);
// Result: A DocumentFragment containing text nodes and a <b> element, with a <i> child element
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #sanitize #javascript
ADD COMMENT
Topic
Name
3+6 =