Last active
August 29, 2015 14:25
-
-
Save accidentallyc/427ff433cab001fe6d6d to your computer and use it in GitHub Desktop.
REQUIRE a dom to be retrieved via jQuery. Useful for keeping projects in tact specially when changes keep happening.
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
/* Assumes that jQuery has been loaded */ | |
window.$REQUIRE = function(s){ | |
var e = jQuery.apply(this,arguments); | |
if( e.length ) return e; | |
else throw "DOM " + s + " is required but cannot be found"; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment