| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 1× 103× 3× 1× 2× | /**
* @file rule: button-name
* @author nighca<nighca@live.cn>
*/
module.exports = {
name: 'button-name',
desc: 'Attribute "name" of <button> is not recommended to be set.',
lint: function (getCfg, document, reporter) {
document.querySelectorAll('button[name]').forEach(function (button) {
if (!getCfg(button)) {
return;
}
reporter.warn(button.startIndex, '004', 'Attribute "name" of <button> is not recommended to be set.');
});
}
};
|