Skip to content

jussi-kalliokoski/htmlentities.js

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 

htmlentities.js

A minimal html entities decoder/encoder using DOM.

Disclaimer

You shouldn't use this "library" for anything real, this is made purely for demonstrational purposes. For reasons why using the approach may be harmful, see this issue and the article it links to.

Usage

//Encode string
htmlentities.encode('<&>'); // returns '&lt;&amp;&gt;';

//Decode string
htmlentities.decode('&lt;&amp;&gt;'); // returns '<&>';

//Also, htmlentities() is a shorthand for encode
htmlentities === htmlentities.encode; // true

MIT license

About

A minimal html entities decoder/encoder using DOM.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published