Use inArray for cross-browser support.

Change-Id: I56177ca1c08165651799f1a1d1b677810406dc73