Code coverage report for htmlcs/lib/rules/button-type.js

Statements: 100% (5 / 5)      Branches: 100% (2 / 2)      Functions: 100% (2 / 2)      Lines: 100% (5 / 5)      Ignored: none     

All files » htmlcs/lib/rules/ » button-type.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23          1             37 36     1 2          
/**
 * @file rule: button-type
 * @author nighca<nighca@live.cn>
 */
 
module.exports = {
 
    name: 'button-type',
 
    desc: 'Attribute "type" of <button> is recommended to be set.',
 
    lint: function (enable, document, reporter) {
        if (!enable) {
            return;
        }
 
        document.querySelectorAll('button:not([type]), button[type=""]').forEach(function (button) {
            reporter.warn(button, '005', 'Attribute "type" of <button> is recommended to be set.');
        });
    }
 
};