Skip to content

Commit

Permalink
Adding support for a white list of elements that can be lower case.
Browse files Browse the repository at this point in the history
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"]
}
```
  • Loading branch information
aaronkahlhamer committed Jan 17, 2017
1 parent 152a114 commit ccfdae5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/rules/tagname-lowercase.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
HTMLHint.addRule({
id: 'tagname-lowercase',
description: 'All html element names must be in lowercase.',
init: function(parser, reporter){
init: function(parser, reporter, options){
var self = this;
var exceptions = Array.isArray(options) ? options : [];
parser.addListener('tagstart,tagend', function(event){
var tagName = event.tagName;
if(tagName !== tagName.toLowerCase()){
if (exceptions.indexOf(tagName) === -1 && tagName !== tagName.toLowerCase()){
reporter.error('The html element name of [ '+tagName+' ] must be in lowercase.', event.line, event.col, self, event.raw);
}
});
}
});
});

0 comments on commit ccfdae5

Please sign in to comment.