Created
April 6, 2017 14:18
-
-
Save trnktms/f87b55dbdbd2b6cbe84b8a3fe294ce55 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fieldBase () {} | |
fieldBase.getParentIframe = function () { | |
var iframes = window.parent.document.getElementsByTagName('iframe'); | |
var parent; | |
Array.prototype.forEach.call(iframes, function (el, i) { | |
if (fieldBase.getIframeDocument(el) === window.document) { | |
parent = el; | |
return; | |
} | |
}); | |
return parent; | |
}; | |
fieldBase.getIframeDocument = function (iframe) { | |
return iframe.contentDocument || iframe.contentWindow.document; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment