macek/jquery-serialize-object

Very slow with big forms

danielsantiago opened this issue · 2 comments

Hi,

I'm having a performance problem with a form that have more than 800 fields (don't ask me why). It's taking more than 250ms to execute "serializeJSON".

I notice that is when calling "tryToFindTypeFromDataAttr". Is there a way to skip the type check from the dom?

My temporary fix:

function getFormValues() {

    //Prevent serializeJSON from checking types
    var tempFn = $.serializeJSON.tryToFindTypeFromDataAttr;

    $.serializeJSON.tryToFindTypeFromDataAttr = function() { return null; };

    var values = $('#Form').serializeJSON();

    $.serializeJSON.tryToFindTypeFromDataAttr = tempFn;

    return values;
}
macek commented

I think you might have the wrong plugin repository. I'm aware there are other serializeJSON or serializeObject plugins, but that API is not ours. Also, you won't find tryToFindTypeFromDataAttr anywhere in our source code.

Let me know if I can help you out in any other way.