Fixes "function" test against regular expressions

In some browser engines (especially older versions of Webkit), this
test fails when the argument is a RegExp.

See:
http://stackoverflow.com/questions/5054352/why-use-typeof-for-identifyin
g-a-function

Fix tested and works with Adobe AIR.
This commit is contained in:
Matthew Dean
2014-01-02 15:04:02 -08:00
parent 58af9f9763
commit 13aba08ed8

View File

@@ -224,7 +224,7 @@ less.Parser = function Parser(env) {
}
function expect(arg, msg) {
var result = (typeof arg === "function") ? arg.call(parsers) : $(arg);
var result = (Object.prototype.toString.call(arg) === '[object Function]') ? arg.call(parsers) : $(arg);
if (result) {
return result;
}