Code coverage report for string/escapeHtml.js

Statements: 100% (6 / 6)      Branches: 100% (0 / 0)      Functions: 100% (3 / 3)      Lines: 100% (5 / 5)     

All files » string/ » escapeHtml.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 191         1 3           3     1      
define(['../lang/toString'], function(toString) {
 
    /**
     * Escapes a string for insertion into HTML.
     */
    function escapeHtml(str){
        str = toString(str)
            .replace(/&/g, '&')
            .replace(/</g, '&lt;')
            .replace(/>/g, '&gt;')
            .replace(/'/g, '&#39;')
            .replace(/"/g, '&quot;');
        return str;
    }
 
    return escapeHtml;
 
});