File tree Expand file tree Collapse file tree 4 files changed +121
-4
lines changed Expand file tree Collapse file tree 4 files changed +121
-4
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ const { registerWalker } = require('../walker');
1414const Container = require ( './Container' ) ;
1515const Punctuation = require ( './Punctuation' ) ;
1616
17- const allFunctions = [
17+ const cssFunctions = [
1818 'annotation' ,
1919 'attr' ,
2020 'blur' ,
@@ -85,7 +85,7 @@ const allFunctions = [
8585 'var'
8686] ;
8787const vendorPrefixes = [ '-webkit-' , '-moz-' , '-ms-' , '-o-' ] ;
88- const reFunctions = new RegExp ( `^(${ vendorPrefixes . join ( '|' ) } )?(${ allFunctions . join ( '|' ) } )` , 'i' ) ;
88+ const reFunctions = new RegExp ( `^(${ vendorPrefixes . join ( '|' ) } )?(${ cssFunctions . join ( '|' ) } )` , 'i' ) ;
8989const rePunctuation = new RegExp ( `^(\\${ Punctuation . chars . join ( '|\\' ) } )` ) ;
9090const reColorFunctions = / ^ ( h s l a ? | h w b | l a b | l c h | r g b a ? ) $ / i;
9191const reVar = / ^ v a r $ / i;
@@ -122,7 +122,8 @@ class Func extends Container {
122122 let lastToken = brackets ;
123123
124124 // fixes #92
125- if ( ! reFunctions . test ( node . name ) && ! / ^ [ a - z A - Z ] + $ / . test ( node . name ) ) {
125+ // eslint-disable-next-line no-useless-escape
126+ if ( ! reFunctions . test ( node . name ) && ! / ^ [ a - z A - Z \- ] + $ / . test ( node . name ) ) {
126127 const nameTokens = getTokens ( node . name ) ;
127128 tokens . unshift ( ...nameTokens , brackets ) ;
128129 parser . back ( tokens ) ;
Original file line number Diff line number Diff line change @@ -45,7 +45,9 @@ module.exports = {
4545 'rotate(0.5grad)' ,
4646 'rotate(0.5turn)' ,
4747 '1em/var(--line-height)' ,
48- 'local(foo),local(bar)'
48+ 'local(foo),local(bar)' ,
49+ 'bat-man(#000)' ,
50+ 'conic-gradient()'
4951 ] ,
5052
5153 throws : [ 'url( /gfx/img/bg.jpg ' ]
Original file line number Diff line number Diff line change @@ -845,6 +845,78 @@ Generated by [AVA](https://avajs.dev).
845845 },
846846 ]
847847
848+ ## bat-man(#000 )
849+
850+ > Snapshot 1
851+
852+ 'bat-man(#000)'
853+
854+ > Snapshot 2
855+
856+ 'bat-man(#000)'
857+
858+ > Snapshot 3
859+
860+ [
861+ Func {
862+ isColor: false,
863+ isVar: false,
864+ name: 'bat-man',
865+ nodes: [
866+ Word {
867+ isColor: true,
868+ isHex: true,
869+ isUrl: false,
870+ isVariable: false,
871+ parent: [Circular],
872+ raws: {
873+ after: '',
874+ before: '',
875+ },
876+ source: {
877+ end: {
878+ column: 1,
879+ line: 1,
880+ },
881+ input: Input {
882+ css: '#000',
883+ hasBOM: false,
884+ id: '<input css 78>',
885+ },
886+ start: {
887+ column: 1,
888+ line: 1,
889+ },
890+ },
891+ type: 'word',
892+ value: '#000',
893+ },
894+ ],
895+ params: '(#000)',
896+ raws: {
897+ after: '',
898+ before: '',
899+ semicolon: false,
900+ },
901+ source: {
902+ end: {
903+ column: 8,
904+ line: 1,
905+ },
906+ input: Input {
907+ css: 'bat-man(#000)',
908+ hasBOM: false,
909+ id: '<input css 77>',
910+ },
911+ start: {
912+ column: 1,
913+ line: 1,
914+ },
915+ },
916+ type: 'func',
917+ },
918+ ]
919+
848920## calc(((768px - 100vw) / 2) - 15px)
849921
850922> Snapshot 1
@@ -1475,6 +1547,48 @@ Generated by [AVA](https://avajs.dev).
14751547 },
14761548 ]
14771549
1550+ ## conic-gradient()
1551+
1552+ > Snapshot 1
1553+
1554+ 'conic-gradient()'
1555+
1556+ > Snapshot 2
1557+
1558+ 'conic-gradient()'
1559+
1560+ > Snapshot 3
1561+
1562+ [
1563+ Func {
1564+ isColor: false,
1565+ isVar: false,
1566+ name: 'conic-gradient',
1567+ nodes: [],
1568+ params: '()',
1569+ raws: {
1570+ after: '',
1571+ before: '',
1572+ },
1573+ source: {
1574+ end: {
1575+ column: 15,
1576+ line: 1,
1577+ },
1578+ input: Input {
1579+ css: 'conic-gradient()',
1580+ hasBOM: false,
1581+ id: '<input css 79>',
1582+ },
1583+ start: {
1584+ column: 1,
1585+ line: 1,
1586+ },
1587+ },
1588+ type: 'func',
1589+ },
1590+ ]
1591+
14781592## hwb(90deg 0% 0% / 0.5)
14791593
14801594> Snapshot 1
You can’t perform that action at this time.
0 commit comments