diff --git a/lib/nodes/Func.js b/lib/nodes/Func.js
index 2cf5711..8e10127 100644
--- a/lib/nodes/Func.js
+++ b/lib/nodes/Func.js
@@ -14,7 +14,7 @@ const { registerWalker } = require('../walker');
const Container = require('./Container');
const Punctuation = require('./Punctuation');
-const allFunctions = [
+const cssFunctions = [
'annotation',
'attr',
'blur',
@@ -85,7 +85,7 @@ const allFunctions = [
'var'
];
const vendorPrefixes = ['-webkit-', '-moz-', '-ms-', '-o-'];
-const reFunctions = new RegExp(`^(${vendorPrefixes.join('|')})?(${allFunctions.join('|')})`, 'i');
+const reFunctions = new RegExp(`^(${vendorPrefixes.join('|')})?(${cssFunctions.join('|')})`, 'i');
const rePunctuation = new RegExp(`^(\\${Punctuation.chars.join('|\\')})`);
const reColorFunctions = /^(hsla?|hwb|lab|lch|rgba?)$/i;
const reVar = /^var$/i;
@@ -122,7 +122,8 @@ class Func extends Container {
let lastToken = brackets;
// fixes #92
- if (!reFunctions.test(node.name) && !/^[a-zA-Z]+$/.test(node.name)) {
+ // eslint-disable-next-line no-useless-escape
+ 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 d757365..a4a23bd 100644
--- a/test/fixtures/func.js
+++ b/test/fixtures/func.js
@@ -45,7 +45,9 @@ module.exports = {
'rotate(0.5grad)',
'rotate(0.5turn)',
'1em/var(--line-height)',
- 'local(foo),local(bar)'
+ 'local(foo),local(bar)',
+ 'bat-man(#000)',
+ 'conic-gradient()'
],
throws: ['url( /gfx/img/bg.jpg ']
diff --git a/test/snapshots/func.test.js.md b/test/snapshots/func.test.js.md
index 918a297..c921298 100644
--- a/test/snapshots/func.test.js.md
+++ b/test/snapshots/func.test.js.md
@@ -845,6 +845,78 @@ Generated by [AVA](https://avajs.dev).
},
]
+## bat-man(#000)
+
+> Snapshot 1
+
+ 'bat-man(#000)'
+
+> Snapshot 2
+
+ 'bat-man(#000)'
+
+> Snapshot 3
+
+ [
+ Func {
+ isColor: false,
+ isVar: false,
+ name: 'bat-man',
+ nodes: [
+ Word {
+ isColor: true,
+ isHex: true,
+ isUrl: false,
+ isVariable: false,
+ parent: [Circular],
+ raws: {
+ after: '',
+ before: '',
+ },
+ source: {
+ end: {
+ column: 1,
+ line: 1,
+ },
+ input: Input {
+ css: '#000',
+ hasBOM: false,
+ id: '',
+ },
+ start: {
+ column: 1,
+ line: 1,
+ },
+ },
+ type: 'word',
+ value: '#000',
+ },
+ ],
+ params: '(#000)',
+ raws: {
+ after: '',
+ before: '',
+ semicolon: false,
+ },
+ source: {
+ end: {
+ column: 8,
+ line: 1,
+ },
+ input: Input {
+ css: 'bat-man(#000)',
+ hasBOM: false,
+ id: '',
+ },
+ start: {
+ column: 1,
+ line: 1,
+ },
+ },
+ type: 'func',
+ },
+ ]
+
## calc(((768px - 100vw) / 2) - 15px)
> Snapshot 1
@@ -1475,6 +1547,48 @@ Generated by [AVA](https://avajs.dev).
},
]
+## conic-gradient()
+
+> Snapshot 1
+
+ 'conic-gradient()'
+
+> Snapshot 2
+
+ 'conic-gradient()'
+
+> Snapshot 3
+
+ [
+ Func {
+ isColor: false,
+ isVar: false,
+ name: 'conic-gradient',
+ nodes: [],
+ params: '()',
+ raws: {
+ after: '',
+ before: '',
+ },
+ source: {
+ end: {
+ column: 15,
+ line: 1,
+ },
+ input: Input {
+ css: 'conic-gradient()',
+ hasBOM: false,
+ id: '',
+ },
+ start: {
+ column: 1,
+ line: 1,
+ },
+ },
+ type: 'func',
+ },
+ ]
+
## hwb(90deg 0% 0% / 0.5)
> Snapshot 1
diff --git a/test/snapshots/func.test.js.snap b/test/snapshots/func.test.js.snap
index 5d3f9d1..eb310c1 100644
Binary files a/test/snapshots/func.test.js.snap and b/test/snapshots/func.test.js.snap differ