Created
October 23, 2012 17:56
-
-
Save gcpantazis/3940352 to your computer and use it in GitHub Desktop.
Creating and Destroying Iframes, Qunit Tests.
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
// Create an <iframe>, return the DOM object | |
// back to the caller once loaded. | |
var iframeLoad = function(pageURL, cb){ | |
var iframe = document.createElement('iframe'); | |
iframe.onload = function(event) { | |
// Return iframe to callback. | |
cb(event.target); | |
}; | |
iframe.src = pageURL; | |
document.body.appendChild(iframe); | |
} | |
// Provide method for destroying a given <iframe> in teardowns. | |
var iframeUnload = function(iframe){ | |
document.body.removeChild(iframe); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment