javascriptjquery.netsafariasp.net-bundling

syntax error on safari after bundling code


Hi I have JavaScript function that's throwing syntax error on safari but the code works in all other browsers (chrome, ff). I am receiving this error only after the inbuild minification process bundling of .Net.

Error: SyntaxError: Unexpected token 'function'

Before bundling :

function btnStatus($btn, $status) {

    if ($status) {
        $btn.prop('disabled', false);
    }
    else {
        $btn.attr('disabled', true);
    }

    return false;
}

After bundling :

function btnStatus(n, t) { return t ? n.prop("disabled", !1) : n.attr("disabled", !0), !1}

Can someone show me the insight of this error!


Solution

  • Actual problem is not due to btnStatus function. it's because of the minification process of ASP.NET on bundling. When I disabled the minification process it works. Honestly I don't understand why safari producing error but not other browsers.

    Fortunately disabling minification on bundling is already explain in stack overflow here by @Rudi Visser answer.