Created
September 8, 2015 16:52
-
-
Save foleyatwork/1ce6470d84b0092c067f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// YUI | |
if (Y.one('.some-el')) { | |
// returns undefined if .some-el is not on the page. | |
} | |
// jQuery (incorrect) | |
if ($('.some-el')) { | |
// returns an array if .some-el is not on the page. | |
} | |
// jQuery (correct) | |
if ($('.some-el').length > 0) { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment