File tree 4 files changed +121
-4
lines changed
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');
14
14
const Container = require ( './Container' ) ;
15
15
const Punctuation = require ( './Punctuation' ) ;
16
16
17
- const allFunctions = [
17
+ const cssFunctions = [
18
18
'annotation' ,
19
19
'attr' ,
20
20
'blur' ,
@@ -85,7 +85,7 @@ const allFunctions = [
85
85
'var'
86
86
] ;
87
87
const 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' ) ;
89
89
const rePunctuation = new RegExp ( `^(\\${ Punctuation . chars . join ( '|\\' ) } )` ) ;
90
90
const reColorFunctions = / ^ ( h s l a ? | h w b | l a b | l c h | r g b a ? ) $ / i;
91
91
const reVar = / ^ v a r $ / i;
@@ -122,7 +122,8 @@ class Func extends Container {
122
122
let lastToken = brackets ;
123
123
124
124
// 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 ) ) {
126
127
const nameTokens = getTokens ( node . name ) ;
127
128
tokens . unshift ( ...nameTokens , brackets ) ;
128
129
parser . back ( tokens ) ;
Original file line number Diff line number Diff line change @@ -45,7 +45,9 @@ module.exports = {
45
45
'rotate(0.5grad)' ,
46
46
'rotate(0.5turn)' ,
47
47
'1em/var(--line-height)' ,
48
- 'local(foo),local(bar)'
48
+ 'local(foo),local(bar)' ,
49
+ 'bat-man(#000)' ,
50
+ 'conic-gradient()'
49
51
] ,
50
52
51
53
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).
845
845
},
846
846
]
847
847
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
+
848
920
## calc(((768px - 100vw) / 2) - 15px)
849
921
850
922
> Snapshot 1
@@ -1475,6 +1547,48 @@ Generated by [AVA](https://avajs.dev).
1475
1547
},
1476
1548
]
1477
1549
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
+
1478
1592
## hwb(90deg 0% 0% / 0.5)
1479
1593
1480
1594
> Snapshot 1
You can’t perform that action at this time.
0 commit comments