Skip to content

Commit

Permalink
fixes bug trullock#331
Browse files Browse the repository at this point in the history
  • Loading branch information
trullock committed Jul 21, 2022
1 parent 7a62a6f commit 6994821
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/NUglify.Tests/Css/Bugs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,5 +128,13 @@ public void Bug309()
--custom-property: 0px;
}").Code);
}


[Test]
public void Bug331()
{
TestHelper.Instance.RunTest();
}

}
}
6 changes: 6 additions & 0 deletions src/NUglify.Tests/NUglify.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,9 @@
<Content Include="TestData\CSS\Expected\Bugs\Bug250.css">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="TestData\CSS\Expected\Bugs\Bug331.css">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="TestData\CSS\Expected\Bugs\Bug74.css">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
Expand Down Expand Up @@ -431,6 +434,9 @@
<Content Include="TestData\CSS\Input\AtRules\RazorEscapedDoubleAt.css">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="TestData\CSS\Input\Bugs\Bug331.css">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="TestData\CSS\Input\Bugs\Bug270.css">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
Expand Down
1 change: 1 addition & 0 deletions src/NUglify.Tests/TestData/CSS/Expected/Bugs/Bug331.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.selector{--variable:;color:#f00}.selector2{--variable:}
7 changes: 7 additions & 0 deletions src/NUglify.Tests/TestData/CSS/Input/Bugs/Bug331.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.selector {
--variable: ;
color: red;
}
.selector2 {
--variable:;
}
6 changes: 5 additions & 1 deletion src/NUglify/Css/CssParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2627,7 +2627,11 @@ Parsed ParseDeclaration()
}
else
{
m_parsingColorValue = MightContainColorNames(propertyName);
// valueless variable declarations are legal
if (propertyName.StartsWith("--") && CurrentTokenText == ";")
return Parsed.True;

m_parsingColorValue = MightContainColorNames(propertyName);
parsed = ParseExpr();
m_parsingColorValue = false;

Expand Down

0 comments on commit 6994821

Please sign in to comment.