Skip to content

Commit a8bd623

Browse files
committed
Merge pull request TrySound#24 from MohammadYounes/specs
Conform with specs
2 parents 5c7fb33 + 38b09ef commit a8bd623

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

lib/parse.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ module.exports = function (input) {
214214
code === doubleQuote ||
215215
code === comma ||
216216
code === colon ||
217-
code === slash && value.charCodeAt(next + 1) !== star ||
217+
code === slash ||
218218
code === openParentheses ||
219219
code === closeParentheses && balanced
220220
));

test/parse.js

+17-2
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,21 @@ var tests = [{
405405
]
406406
}, {
407407
message: 'should parse comments inside functions',
408+
fixture: 'rgba( 0, 55/55, 0/*,.5*/ )',
409+
expected: [
410+
{ type: 'function', sourceIndex: 0, value: 'rgba', before: ' ', after: ' ', nodes: [
411+
{ type: 'word', sourceIndex: 6, value: '0' },
412+
{ type: 'div', sourceIndex: 7, value: ',', before:'', after: ' ' },
413+
{ type: 'word', sourceIndex: 9, value: '55' },
414+
{ type: 'div', sourceIndex: 11, value: '/', before:'', after: '' },
415+
{ type: 'word', sourceIndex: 12, value: '55' },
416+
{ type: 'div', sourceIndex: 14, value: ',', before:'', after: ' ' },
417+
{ type: 'word', sourceIndex: 16, value: '0' },
418+
{ type: 'comment', sourceIndex: 17, value: ',.5'}
419+
] }
420+
]
421+
}, {
422+
message: 'should parse comments at the end of url functions with quoted first argument',
408423
fixture: 'url( "/demo/bg.png" /*comment*/ )',
409424
expected: [
410425
{ type: 'function', sourceIndex: 0, value: 'url', before: ' ', after: ' ', nodes: [
@@ -414,15 +429,15 @@ var tests = [{
414429
] }
415430
]
416431
}, {
417-
message: 'should parse comments at the start of url function',
432+
message: 'should not parse comments at the start of url function with unquoted first argument',
418433
fixture: 'url( /*comment*/ /demo/bg.png )',
419434
expected: [
420435
{ type: 'function', sourceIndex: 0, value: 'url', before: ' ', after: ' ', nodes: [
421436
{ type: 'word', sourceIndex: 5, value: '/*comment*/ /demo/bg.png'},
422437
] }
423438
]
424439
}, {
425-
message: 'should not parse comments in the end of url function',
440+
message: 'should not parse comments at the end of url function with unquoted first argument',
426441
fixture: 'url( /demo/bg.png /*comment*/ )',
427442
expected: [
428443
{ type: 'function', sourceIndex: 0, value: 'url', before: ' ', after: ' ', nodes: [

0 commit comments

Comments
 (0)