Skip to content

Using jquery's $.map flattens array arguments in the callbacks #146

Closed
@mtraynham

Description

@mtraynham

Encountered during the upgrade to 1.0.9, likely caused by #102

If you have a onDrop callback that has an array argument, jquery's map function will flatten that array.

For instance:

$.map([1, 2, 3], function(element, index) {
  return [ element + 1, element + 2 ];
});
=> [2, 3, 3, 4, 4, 5]

I pass the drop target array reference as an argument in the onDrop callback. Workaround is wrapping that array reference with an array as shown from: http://stackoverflow.com/questions/703355/is-there-a-jquery-map-utility-that-doesnt-automically-flatten:

$.map([1, 2, 3], function(element, index) {
  return [ [ element + 1, element + 2 ] ];
});
=> [[2, 3], [3, 4], [4, 5]]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions