Created
January 27, 2013 03:45
-
-
Save anonymous/4646158 to your computer and use it in GitHub Desktop.
Yo dawg, I herd you like loops, so jQuery put a loop in your code
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
// Indications of Confusion | |
$( ".bla" ).each( function() { | |
$( this ).css( "color", "green" ); | |
}); |
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
// Explicit Loops | |
$( ".bla" ).each( function( index, element ) { | |
$( element ).append( index ); | |
}); |
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
// Implicit Loops | |
$( ".bla" ).addClass( "highlight" ); |
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
// Performance Implications | |
$( ".bla" ).css( "x", "y" ).css( "a", "b" ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment