Code coverage report for sanitize-caja/index.js

Statements: 100% (14 / 14)      Branches: 100% (10 / 10)      Functions: 100% (3 / 3)      Lines: 100% (10 / 10)      Ignored: none     

All files » sanitize-caja/ » index.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 191   1 14 13       1   6 3 2 1       1  
var html_sanitize = require('./sanitizer-bundle.js');
 
module.exports = function(_) {
    if (!_) return '';
    return html_sanitize(_, cleanUrl, cleanId);
};
 
// https://bugzilla.mozilla.org/show_bug.cgi?id=255107
function cleanUrl(url) {
    'use strict';
    if (/^https?/.test(url.getScheme())) return url.toString();
    if (/^mailto?/.test(url.getScheme())) return url.toString();
    if ('data' == url.getScheme() && /^image/.test(url.getPath())) {
        return url.toString();
    }
}
 
function cleanId(id) { return id; }