From 5d96513991635e3e22d7aa54a8584d6ce97cace8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20F=2E=20Romaniello?= Date: Fri, 27 Sep 2013 11:46:30 -0300 Subject: [PATCH] convert string to array ie7 workarround This is a workarround for IE7 where strings can't be used as arrays directly. --- index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/index.js b/index.js index 426017b..5c94679 100644 --- a/index.js +++ b/index.js @@ -17,6 +17,9 @@ var hasOwnProperty = Object.prototype.hasOwnProperty; var indexOf = typeof Array.prototype.indexOf === 'function' ? function(arr, el) { return arr.indexOf(el); } : function(arr, el) { + if (typeof arr == 'string' && typeof "a"[0] == 'undefined') { + arr = arr.split(''); + } for (var i = 0; i < arr.length; i++) { if (arr[i] === el) return i; }