]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #4034 now using approach that exists in IE to find elements in an Array
authorCash Costello <cash.costello@gmail.com>
Fri, 4 Nov 2011 00:37:50 +0000 (20:37 -0400)
committerCash Costello <cash.costello@gmail.com>
Fri, 4 Nov 2011 00:37:50 +0000 (20:37 -0400)
js/lib/elgglib.js

index d963a62be9a947ccbb56deba40a8893d277b4a8e..85251c1e81cb425084af0b32efb254898f92c53d 100644 (file)
@@ -535,7 +535,7 @@ elgg.push_to_object_array = function(object, parent, value) {
                object[parent] = []
        }
 
-       if (object[parent].indexOf(value) < 0) {
+       if ($.inArray(value, object[parent]) < 0) {
                return object[parent].push(value);
        }
 
@@ -553,7 +553,7 @@ elgg.is_in_object_array = function(object, parent, value) {
        elgg.assertTypeOf('object', object);
        elgg.assertTypeOf('string', parent);
 
-       return typeof(object[parent]) != 'undefined' && object[parent].indexOf(value) >= 0;
+       return typeof(object[parent]) != 'undefined' && $.inArray(value, object[parent]) >= 0;
 };
 
 /**