Skip to content

Commit 1fba7fb

Browse files
committed
fix handling of unterminated comment. Closes #24
1 parent 48bbfbf commit 1fba7fb

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

index.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,16 @@ module.exports = function(css){
7777

7878
function comment() {
7979
if ('/' != css[0] || '*' != css[1]) return;
80+
8081
var i = 2;
81-
while ('*' != css[i] || '/' != css[i + 1]) ++i;
82+
while (null != css[i] && ('*' != css[i] || '/' != css[i + 1])) ++i;
8283
i += 2;
83-
var comment = css.slice(2, i - 2);
84+
85+
var str = css.slice(2, i - 2);
8486
css = css.slice(i);
8587
whitespace();
86-
return { comment: comment };
88+
89+
return { comment: str };
8790
}
8891

8992
/**

0 commit comments

Comments
 (0)