Merge pull request #156 from ubershmekel/patch-2

Late load of paperjs should still run paperscripts
This commit is contained in:
Jürg Lehni 2013-02-14 12:49:51 -08:00
commit 6729646e7a

View file

@ -294,7 +294,13 @@ var PaperScript = this.PaperScript = new function() {
}
}
DomEvent.add(window, { load: load });
// Catch cases where paperjs is loaded after the browser event has already occurred.
if ( document.readyState === "complete" ) {
// Handle it asynchronously
setTimeout( load );
} else {
DomEvent.add(window, { load: load });
}
// Produces helpers to e.g. check for both 'canvas' and 'data-paper-canvas'
// attributes: