Skip to content

Instantly share code, notes, and snippets.

@joshed-io
Created June 9, 2011 00:25
Show Gist options
  • Save joshed-io/1015783 to your computer and use it in GitHub Desktop.
Save joshed-io/1015783 to your computer and use it in GitHub Desktop.
yepnope.js preload! prefix not working out of box
//on Chrome 12 on OSX
//after loading in vanilla yepnope js from
//https://github.com/SlexAxton/yepnope.js/blob/master/yepnope.js
//calling this results in application.js loading into an <img> tag then *executing* despite !preload prefix
yepnope("preload!/javascripts/application.js");
//on line 410 of the lib there is a resource.noexec check, but no other refs in the lib to 'noexec'
//when setting this to true, the desired load-but-dont-execute behavior works.
//likewise, rolling my own preload! prefix to set noexec...
yepnope.addPrefix("preload", function(resource) {
resource.noexec = true;
return resource;
});
//then executing...
yepnope("preload!/javascripts/application.js");
//also results in the desired load-but-dont-execute behavior. I'd guess the built-in prefix is supposed to do this...
//so I'm not sure where the disconnect is.
//- *RESOLUTION* - the 'built-in' prefix isn't actually in the yepnope.js download, but it is
//in the distro/github repo on /prefixes, and you'd have to add it yourself.
//sure enough the code is identical to the above.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment