Skip to content

Commit 1b649c2

Browse files
committed
Merge pull request #121 from molant/lowercase-whitelist
Adding support for a white list of attributes that can be lower case.
2 parents fa5913f + db994d7 commit 1b649c2

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/rules/attr-lowercase.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,20 @@
55
HTMLHint.addRule({
66
id: 'attr-lowercase',
77
description: 'All attribute names must be in lowercase.',
8-
init: function(parser, reporter){
8+
init: function(parser, reporter, options){
99
var self = this;
10+
var exceptions = Array.isArray(options) ? options : [];
1011
parser.addListener('tagstart', function(event){
1112
var attrs = event.attrs,
1213
attr,
1314
col = event.col + event.tagName.length + 1;
1415
for(var i=0, l=attrs.length;i<l;i++){
1516
attr = attrs[i];
1617
var attrName = attr.name;
17-
if(attrName !== attrName.toLowerCase()){
18+
if (exceptions.indexOf(attrName) === -1 && attrName !== attrName.toLowerCase()){
1819
reporter.error('The attribute name of [ '+attrName+' ] must be in lowercase.', event.line, col + attr.index, self, attr.raw);
1920
}
2021
}
2122
});
2223
}
23-
});
24+
});

0 commit comments

Comments
 (0)