[Pkg-javascript-commits] [sockjs-client] 100/434: IE doesn't support [].indexOf.

Tonnerre Lombard tonnerre-guest at moszumanska.debian.org
Wed Jan 8 00:47:06 UTC 2014


This is an automated email from the git hooks/post-receive script.

tonnerre-guest pushed a commit to branch master
in repository sockjs-client.

commit 9d4c1788982c8d998792cea20d6142acd970f28a
Author: Marek Majkowski <majek04 at gmail.com>
Date:   Thu Aug 25 14:57:27 2011 +0100

    IE doesn't support [].indexOf.
---
 lib/reventtarget.js |  2 +-
 lib/utils.js        | 10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/lib/reventtarget.js b/lib/reventtarget.js
index a3b771a..d5bc526 100644
--- a/lib/reventtarget.js
+++ b/lib/reventtarget.js
@@ -14,7 +14,7 @@ REventTarget.prototype.removeEventListener = function (eventType, listener) {
         return false;
     }
     var arr = this._listeners[eventType];
-    var idx = arr.indexOf(listener);
+    var idx = utils.arrIndexOf(arr, listener);
     if (idx !== -1) {
         if(arr.length > 1) {
             this._listeners[eventType] = arr.slice(0, idx).concat( arr.slice(idx+1) );
diff --git a/lib/utils.js b/lib/utils.js
index ab9f54c..232aae4 100644
--- a/lib/utils.js
+++ b/lib/utils.js
@@ -325,3 +325,13 @@ utils.amendUrl = function(url) {
     }
     return url;
 };
+
+// IE doesn't support [].indexOf.
+utils.arrIndexOf = function(arr, obj){
+	for(var i=0; i < arr.length; i++){
+		if(arr[i] === obj){
+			return i;
+		}
+	}
+    return -1;
+};
\ No newline at end of file

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/sockjs-client.git



More information about the Pkg-javascript-commits mailing list