documentcloud/backbone — Issue #832: Weird behaviour of Collection.without
Author: Sephi-Chan
Created: 2011-12-30 16:26:38+00:00
State: open

Hi,

I noticed a weird behaviour for `without` method on collections with the following code.

``` coffee
remainingTerritories = allTerritories.without(territoriesToReject)
```

Both `allTerritories` and `territoriesToReject` are `Territories` collections containing Territory objects, and some of these territories to reject come from the pool of territories, matching with `===`).
`remainingTerritories` contains a regular Array containing all the Territory objects no one is filtered out.
I would expect to get all the territories minus the ones to reject.

To achieve my goal, I had to write:

``` coffee
remainingTerritories = new Territories(allTerritories.reject (t)-> territoriesToReject.include(t))
```

It's not a big deal but I would be glad to know why, and if I can help fixing that if it's not the expected behaviour.