Make $.contains more efficient

The previous implementation checked every single array element even if it has already found a match.