Last active
October 1, 2015 13:19
-
-
Save hejrobin/9dfd2962954e25c13dca to your computer and use it in GitHub Desktop.
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
console.log($('some.selector').exists()); | |
$('some.other.selector').exists(function(){ | |
/* I've got the maaagic in meeee */ | |
}) |
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
do (window, jQuery) -> | |
unless jQuery.fn.exists | |
unless callback? or typeof callback isnt 'function' | |
callback = => @length > 0 | |
callback.apply this | |
return |
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
(function(window, jQuery) { | |
var callback; | |
if (!jQuery.fn.exists) { | |
if (!((typeof callback !== "undefined" && callback !== null) || typeof callback !== 'function')) { | |
callback = (function(_this) { | |
return function() { | |
return _this.length > 0; | |
}; | |
})(this); | |
} | |
callback.apply(this); | |
} | |
})(window, jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment