diff options
Diffstat (limited to 'test/data')
-rw-r--r-- | test/data/readywaitasset.js | 1 | ||||
-rw-r--r-- | test/data/readywaitloader.js | 25 |
2 files changed, 26 insertions, 0 deletions
diff --git a/test/data/readywaitasset.js b/test/data/readywaitasset.js new file mode 100644 index 000000000..2308965ce --- /dev/null +++ b/test/data/readywaitasset.js @@ -0,0 +1 @@ +var delayedMessage = "It worked!"; diff --git a/test/data/readywaitloader.js b/test/data/readywaitloader.js new file mode 100644 index 000000000..483e07c4d --- /dev/null +++ b/test/data/readywaitloader.js @@ -0,0 +1,25 @@ +// Simple script loader that uses jQuery.readyWait + +//Hold on jQuery! +jQuery.readyWait++; + +var readyRegExp = /^(complete|loaded)$/; + +function assetLoaded( evt ){ + var node = evt.currentTarget || evt.srcElement; + if ( evt.type === "load" || readyRegExp.test(node.readyState) ) { + jQuery.ready(true); + } +} + +setTimeout( function() { + var script = document.createElement("script"); + script.type = "text/javascript"; + if ( script.addEventListener ) { + script.addEventListener( "load", assetLoaded, false ); + } else { + script.attachEvent( "onreadystatechange", assetLoaded ); + } + script.src = "data/readywaitasset.js"; + document.getElementsByTagName("head")[0].appendChild(script); +}, 2000 ); |