kflorence/jquery-deserialize

handle JSON boolean values for checkboxes true/false values

Opened this issue · 2 comments

I think you could add the following to support JSON boolean values for checkboxes.
This is currently a string comparison only @~line 208

    // Handle select menus, checkboxes and radio buttons
    } else if ( property == "checked" || property == "selected" ) {
      var fields = [];
      var type; 

...

$.each( fields, function( index, field ) {
      
        //next 2 lines added to fix JSON boolean values for checkboxes true/false values
        type = typeof value;
        if ((type === 'boolean' && value.toString() === field.value) || ( field.value == value )) {
          field[ property ] = true;
          callback.call( field, value );
        }
      });

@interloper10 can you add a failing test case for this?