added break functionality to each and IE fallback for Array indexOf

This commit is contained in:
Niklas von Hertzen 2011-07-18 13:18:58 +03:00
parent a9cfbd60a7
commit 9134d7067c

View File

@ -53,7 +53,7 @@ html2canvas.prototype.getBounds = function(el){
html2canvas.prototype.each = function(arrayLoop,callbackFunc){
callbackFunc = callbackFunc || function(){};
for (var i=0;i<arrayLoop.length;i++){
callbackFunc(i,arrayLoop[i]);
if (callbackFunc(i,arrayLoop[i]) === false) return;
}
}
@ -150,3 +150,17 @@ html2canvas.prototype.getContents = function(el){
html2canvas.prototype.getCSS = function(el,attribute){
return $(el).css(attribute);
}
html2canvas.prototype.getIndex = function(array,src){
if (array.indexOf){
return array.indexOf(src);
}else{
for(var i = 0; i < array.length; i++){
if(this[i] == src) return i;
}
return -1;
}
}