Skip to content

Commit

Permalink
Add a Null Check in windowOfDocument
Browse files Browse the repository at this point in the history
Add a null check for windowOfDocument. It is possible you can’t access
a window.frame when it is cross-domain. This could happen at any index
in the window.frame so best to check all of them.
  • Loading branch information
alanwright committed Jul 25, 2015
1 parent 7285c77 commit 873700d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libs/jquery.simulate.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function isDocument(ele) {

function windowOfDocument(doc) {
for (var i=0; i < window.frames.length; i+=1) {
if (window.frames[i].document === doc) {
if (window.frames[i] && window.frames[i].document === doc) {
return window.frames[i];
}
}
Expand Down

0 comments on commit 873700d

Please sign in to comment.