Skip to content

Commit 25843ac

Browse files
cheerfuloriolethedaviddias
authored andcommitted
chore(htmlhint): adding support for a white list of elements that can be lower case. (#188)
When enabling the rule instead of using a boolean, use an array with the attributes (camelCased) that you want to ignore ```json { "tagname-lowercase": ["clipPath"] } ```
1 parent b5f035c commit 25843ac

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/rules/tagname-lowercase.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
HTMLHint.addRule({
22
id: 'tagname-lowercase',
33
description: 'All html element names must be in lowercase.',
4-
init: function(parser, reporter){
4+
init: function(parser, reporter, options){
55
var self = this;
6+
var exceptions = Array.isArray(options) ? options : [];
67
parser.addListener('tagstart,tagend', function(event){
78
var tagName = event.tagName;
8-
if(tagName !== tagName.toLowerCase()){
9+
if (exceptions.indexOf(tagName) === -1 && tagName !== tagName.toLowerCase()){
910
reporter.error('The html element name of [ '+tagName+' ] must be in lowercase.', event.line, event.col, self, event.raw);
1011
}
1112
});

0 commit comments

Comments
 (0)