You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I came across this the other day. Another developer was using for...in to loop through an Array. In IE, it would include the indexOf function as an item in the area. Very odd, but a pain to figure out.
Recreate:
Include stylish select.
In another javascript file, after stylish select has been run, execute this code:
var arr = [1,2,3];
for(var i in arr){
alert(arr[i]);
alert(typeof(arr[i]));
}
Also it's worth noting that that the indexOf prototype override in this plugin can dramatically affect other code. I had a problem today when some third-party JS (a widget) was relying on indexOf returning -1 when it can't find a given element in the array - the expected response.
However, this module (crazily) returns undefined, completely borking the expected behaviour and resulting in broken widgets everywhere. Discontinued!
I came across this the other day. Another developer was using for...in to loop through an Array. In IE, it would include the indexOf function as an item in the area. Very odd, but a pain to figure out.
Recreate:
Include stylish select.
In another javascript file, after stylish select has been run, execute this code:
var arr = [1,2,3];
for(var i in arr){
alert(arr[i]);
alert(typeof(arr[i]));
}
Question: Do you need to add indexOf to the prototype, or could you just use the $.inArrray()? http://api.jquery.com/jQuery.inArray/
The text was updated successfully, but these errors were encountered: