Skip to content

Commit 9134d70

Browse files
committed
added break functionality to each and IE fallback for Array indexOf
1 parent a9cfbd6 commit 9134d70

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

src/Util.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ html2canvas.prototype.getBounds = function(el){
5353
html2canvas.prototype.each = function(arrayLoop,callbackFunc){
5454
callbackFunc = callbackFunc || function(){};
5555
for (var i=0;i<arrayLoop.length;i++){
56-
callbackFunc(i,arrayLoop[i]);
56+
if (callbackFunc(i,arrayLoop[i]) === false) return;
5757
}
5858
}
5959

@@ -149,4 +149,18 @@ html2canvas.prototype.getContents = function(el){
149149
*/
150150
html2canvas.prototype.getCSS = function(el,attribute){
151151
return $(el).css(attribute);
152+
}
153+
154+
155+
html2canvas.prototype.getIndex = function(array,src){
156+
157+
if (array.indexOf){
158+
return array.indexOf(src);
159+
}else{
160+
for(var i = 0; i < array.length; i++){
161+
if(this[i] == src) return i;
162+
}
163+
return -1;
164+
}
165+
152166
}

0 commit comments

Comments
 (0)