DOM Purify - Web API Documentation

About DOM Purify

DOM Purify is a JavaScript library designed to clean HTML strings by removing unwanted characters and attributes before rendering them into the document.

It provides methods for:

The API is commonly used in web applications to ensure safe rendering of user-generated content.

Key Methods

                    const html = '

Hello, world!

'; const sanitized = DOMPurify.html(html); console.log(sanitized);

Output:

                    

Hello, world!

This example demonstrates how DOM Purify cleans HTML by removing unsafe characters and attributes.

Usage Example

You can use DOM Purify in your projects by including its script directly in your HTML file:

                    // Include DOM Purify via CDN
                    
                

License

DOM Purify is licensed under the MIT License, allowing free use and modification for both commercial and non-commercial projects.

Contact Us

If you have questions about DOM Purify or need help integrating it into your project, please contact us at: