Skip to content

Commit

Permalink
close issue: #79, fix exit with 0 when hint errors
Browse files Browse the repository at this point in the history
attr-unsafe-chars(rule): exclude `\r\n`
  • Loading branch information
yaniswang committed Oct 9, 2015
1 parent de8d955 commit 30860c9
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
6 changes: 4 additions & 2 deletions CHANGE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
HTMLHint change log
====================

## ver 0.9.9 (2015-10-8)
## ver 0.9.9 (2015-10-10)

add:

Expand All @@ -10,7 +10,9 @@ add:

fix:

1. fix end event col
1. close issue: #79, fix exit with 0 when hint errors
2. fix end event col
2. attr-unsafe-chars(rule): exclude `\r\n`

## ver 0.9.8 (2015-10-7)

Expand Down
1 change: 1 addition & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
TODO
==================

security rule
2 changes: 1 addition & 1 deletion lib/htmlhint.js

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions src/rules/attr-unsafe-chars.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ HTMLHint.addRule({
var attrs = event.attrs,
attr,
col = event.col + event.tagName.length + 1;
var regUnsafe = /[\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/;
// exclude \r\n
var regUnsafe = /[\u0000-\u0009\u000b-\u000c\u000d-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/;
for(var i=0, l=attrs.length;i<l;i++){
attr = attrs[i];
if(regUnsafe.test(attr.value) === true){
Expand All @@ -20,4 +21,4 @@ HTMLHint.addRule({
}
});
}
});
});

0 comments on commit 30860c9

Please sign in to comment.