File tree Expand file tree Collapse file tree 2 files changed +76
-4
lines changed Expand file tree Collapse file tree 2 files changed +76
-4
lines changed Original file line number Diff line number Diff line change @@ -1135,13 +1135,16 @@ function isValidInContext(construct, context) {
11351135 return true ;
11361136 }
11371137
1138- // Exclude properties that ended up with a {}-block
1139- // in their value, unless they're custom.
1138+ // Exclude properties that ended up with a {}-block plus
1139+ // a non-whitespace component in their value, unless they're custom.
11401140 if ( construct . type == "DECLARATION" ) {
11411141 if ( construct . name . slice ( 0 , 2 ) == "--" ) return true ;
1142- for ( const val of construct . value ) {
1143- if ( val . type == "BLOCK" && val . name == "{" ) return false ;
1142+
1143+ const block = construct . value . find ( t => t . type === "BLOCK" && t . name === "{" ) ;
1144+ if ( block && construct . value . some ( t => t . type !== "WHITESPACE" && t !== block ) ) {
1145+ return false ;
11441146 }
1147+
11451148 return true ;
11461149 }
11471150}
Original file line number Diff line number Diff line change @@ -3600,6 +3600,75 @@ return [
36003600 "important" : false
36013601 }
36023602 } ,
3603+ {
3604+ "parser" : "parseADeclaration" ,
3605+ "css" : "foo:{}" ,
3606+ "expected" : {
3607+ "type" : "DECLARATION" ,
3608+ "name" : "foo" ,
3609+ "value" : [
3610+ {
3611+ "type" : "BLOCK" ,
3612+ "name" : "{" ,
3613+ "value" : [ ]
3614+ }
3615+ ] ,
3616+ "important" : false
3617+ }
3618+ } ,
3619+ {
3620+ "parser" : "parseADeclaration" ,
3621+ "css" : "foo: {}" ,
3622+ "expected" : {
3623+ "type" : "DECLARATION" ,
3624+ "name" : "foo" ,
3625+ "value" : [
3626+ {
3627+ "type" : "BLOCK" ,
3628+ "name" : "{" ,
3629+ "value" : [ ]
3630+ }
3631+ ] ,
3632+ "important" : false
3633+ }
3634+ } ,
3635+ {
3636+ "parser" : "parseADeclaration" ,
3637+ "css" : "foo:{} " ,
3638+ "expected" : {
3639+ "type" : "DECLARATION" ,
3640+ "name" : "foo" ,
3641+ "value" : [
3642+ {
3643+ "type" : "BLOCK" ,
3644+ "name" : "{" ,
3645+ "value" : [ ]
3646+ }
3647+ ] ,
3648+ "important" : false
3649+ }
3650+ } ,
3651+ {
3652+ "parser" : "parseADeclaration" ,
3653+ "css" : "foo:bar{}" ,
3654+ "expectedThrow" : {
3655+ "name" : "SyntaxError"
3656+ }
3657+ } ,
3658+ {
3659+ "parser" : "parseADeclaration" ,
3660+ "css" : "foo:{}bar" ,
3661+ "expectedThrow" : {
3662+ "name" : "SyntaxError"
3663+ }
3664+ } ,
3665+ {
3666+ "parser" : "parseADeclaration" ,
3667+ "css" : "foo:{}{}" ,
3668+ "expectedThrow" : {
3669+ "name" : "SyntaxError"
3670+ }
3671+ } ,
36033672
36043673 // parseAComponentValue()
36053674 {
You can’t perform that action at this time.
0 commit comments