Code coverage report for htmlcs/lib/rules/doctype.js

Statements: 87.5% (7 / 8)      Branches: 87.5% (7 / 8)      Functions: 100% (1 / 1)      Lines: 87.5% (7 / 8)      Ignored: none     

All files » htmlcs/lib/rules/ » doctype.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30          1             37 35     2 2 1         1            
/**
 * @file rule: doctype
 * @author nighca<nighca@live.cn>
 */
 
module.exports = {
 
    name: 'doctype',
 
    desc: 'DOCTYPE needed.',
 
    lint: function (enable, document, reporter) {
        if (!enable || !document.querySelector('html')) {
            return;
        }
 
        var doctype = document.doctype;
        if (doctype) {
            Iif (doctype.data !== '!DOCTYPE html') {
                reporter.warn(doctype, '028', 'DOCTYPE must be html5');
            }
        }
        else {
            reporter.warn(document, '009', 'DOCTYPE needed.');
        }
 
    }
 
};