diff --git a/lib/nodes/Func.js b/lib/nodes/Func.js index 8e10127..6c4fd37 100644 --- a/lib/nodes/Func.js +++ b/lib/nodes/Func.js @@ -123,7 +123,7 @@ class Func extends Container { // fixes #92 // eslint-disable-next-line no-useless-escape - if (!reFunctions.test(node.name) && !/^[a-zA-Z\-]+$/.test(node.name)) { + if (!reFunctions.test(node.name) && !/^[a-zA-Z\-\.]+$/.test(node.name)) { const nameTokens = getTokens(node.name); tokens.unshift(...nameTokens, brackets); parser.back(tokens); diff --git a/test/fixtures/func.js b/test/fixtures/func.js index a4a23bd..c58e3bf 100644 --- a/test/fixtures/func.js +++ b/test/fixtures/func.js @@ -47,7 +47,8 @@ module.exports = { '1em/var(--line-height)', 'local(foo),local(bar)', 'bat-man(#000)', - 'conic-gradient()' + 'conic-gradient()', + 'color.red(#6b717f)' ], throws: ['url( /gfx/img/bg.jpg '] diff --git a/test/snapshots/func.test.js.md b/test/snapshots/func.test.js.md index 4178005..4591cb5 100644 --- a/test/snapshots/func.test.js.md +++ b/test/snapshots/func.test.js.md @@ -1871,6 +1871,90 @@ Generated by [AVA](https://avajs.dev). }, ] +## color.red(#6b717f) + +> Snapshot 1 + + 'color.red(#6b717f)' + +> Snapshot 2 + + 'color.red(#6b717f)' + +> Snapshot 3 + + [ + Func { + isColor: false, + isVar: false, + name: 'color.red', + nodes: [ + Word { + isColor: true, + isHex: true, + isUrl: false, + isVariable: false, + parent: [Circular], + raws: { + after: '', + before: '', + }, + source: { + end: { + column: 1, + line: 1, + offset: 0, + }, + input: Input { + css: '#6b717f', + hasBOM: false, + id: '', + [Symbol(fromOffset cache)]: [ + 0, + ], + }, + start: { + column: 1, + line: 1, + offset: 0, + }, + }, + type: 'word', + value: '#6b717f', + [Symbol(isClean)]: false, + }, + ], + params: '(#6b717f)', + raws: { + after: '', + before: '', + semicolon: false, + }, + source: { + end: { + column: 10, + line: 1, + offset: 9, + }, + input: Input { + css: 'color.red(#6b717f)', + hasBOM: false, + id: '', + [Symbol(fromOffset cache)]: [ + 0, + ], + }, + start: { + column: 1, + line: 1, + offset: 0, + }, + }, + type: 'func', + [Symbol(isClean)]: false, + }, + ] + ## conic-gradient() > Snapshot 1 diff --git a/test/snapshots/func.test.js.snap b/test/snapshots/func.test.js.snap index 5857a59..610dc5c 100644 Binary files a/test/snapshots/func.test.js.snap and b/test/snapshots/func.test.js.snap differ