diff --git a/sass/chroma/_internals.scss b/sass/chroma/_internals.scss index 55ecf58..7e4647c 100644 --- a/sass/chroma/_internals.scss +++ b/sass/chroma/_internals.scss @@ -132,16 +132,16 @@ // _safe-call() // -// LibSass incorrectly throws an error when using call() with an overloaded -// function; e.g. rgba(). To work-around this bug, we call rgba() directly -// instead of with call(). +// LibSass incorrectly throws an error when using the variable argument +// indicator, ..., with an overloaded function; e.g. rgba(). To work-around this +// bug, we call rgba() with direct parameters. // // @TODO: Remove when the fix for https://github.com/sass/libsass/issues/2205 is released. // // Style guide: internals._safe-call @function _safe-call($function, $parameters...) { @if $function == rgba { - @return rgba($parameters...); + @return rgba(nth($parameters, 1), nth($parameters, 2)); } @return call($function, $parameters...); } diff --git a/test/fixtures/internals/_safe-call/input.scss b/test/fixtures/internals/_safe-call/input.scss new file mode 100644 index 0000000..483093f --- /dev/null +++ b/test/fixtures/internals/_safe-call/input.scss @@ -0,0 +1,8 @@ +@import 'chroma'; + +$function: rgba; +$parameters: #fff, .5; + +.test { + color: _safe-call($function, $parameters...); +} diff --git a/test/fixtures/internals/_safe-call/output.css b/test/fixtures/internals/_safe-call/output.css new file mode 100644 index 0000000..d8a84cd --- /dev/null +++ b/test/fixtures/internals/_safe-call/output.css @@ -0,0 +1,2 @@ +.test { + color: rgba(255, 255, 255, 0.5); } diff --git a/test/test_internals.js b/test/test_internals.js index a441c28..435d1ec 100644 --- a/test/test_internals.js +++ b/test/test_internals.js @@ -68,4 +68,10 @@ describe('@import "chroma/internals";', function() { return sassyTest.renderFixture('_is-keyword-string'); }); }); + + describe('@function _safe-call()', function() { + it('should call an overloaded function without error with LibSass before libsass#2205', function() { + return sassyTest.renderFixture('_safe-call'); + }); + }); });