Skip to content

Commit 6ea4cb2

Browse files
authored
Merge pull request #2950 from nschonni/fix--throw-on-weitht-passed-to-CSS3-invert
fix: throw on weitht passed to CSS3 invert()
2 parents 996dbb3 + d972c50 commit 6ea4cb2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/fn_colors.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,12 +361,16 @@ namespace Sass {
361361
{
362362
// CSS3 filter function overload: pass literal through directly
363363
Number* amount = Cast<Number>(env["$color"]);
364+
double weight = DARG_U_PRCT("$weight");
364365
if (amount) {
366+
// TODO: does not throw on 100% manually passed as value
367+
if (weight < 100.0) {
368+
error("Only one argument may be passed to the plain-CSS invert() function.", pstate, traces);
369+
}
365370
return SASS_MEMORY_NEW(String_Quoted, pstate, "invert(" + amount->to_string(ctx.c_options) + ")");
366371
}
367372

368373
Color* col = ARG("$color", Color);
369-
double weight = DARG_U_PRCT("$weight");
370374
Color_RGBA_Obj inv = col->copyAsRGBA();
371375
inv->r(clip(255.0 - inv->r(), 0.0, 255.0));
372376
inv->g(clip(255.0 - inv->g(), 0.0, 255.0));

0 commit comments

Comments
 (0)