From d3499ea09172357af4e3bfd47634b51696240a66 Mon Sep 17 00:00:00 2001 From: Reno Reckling Date: Tue, 21 Jun 2011 21:31:06 +0200 Subject: [PATCH] remove own inArray implementation i replaced it with the one from dojo which is significantly faster --- .../Default/Views/dojo/scripts/system/phpr.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/phprojekt/application/Default/Views/dojo/scripts/system/phpr.js b/phprojekt/application/Default/Views/dojo/scripts/system/phpr.js index cb1c92821..001a31a9c 100644 --- a/phprojekt/application/Default/Views/dojo/scripts/system/phpr.js +++ b/phprojekt/application/Default/Views/dojo/scripts/system/phpr.js @@ -1137,12 +1137,11 @@ dojo.declare("phpr.ScrollPane", [dijit.layout._LayoutWidget, dijit._Templated], }); phpr.inArray = function(needle, haystack) { - var key = ''; - - for (key in haystack) { - if (haystack[key] === needle) { - return true; - } + //we need to check for this, because for some reason, the function is + //called with undefined as haystack very often + if("Array" == typeof haystack || "Object" == typeof haystack) { + console.log("use new"); + return dojo.indexOf(haystack, needle)!=-1; } return false;