Created
July 22, 2014 22:16
-
-
Save alexkingorg/e8c5f5abad59f96eb837 to your computer and use it in GitHub Desktop.
JS micro-optimization?
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
// readable and easily re-orderable | |
$(document).on('submit', '#foo', myCallback1); | |
$(document).on('submit', '#bar', myCallback2); | |
$(document).on('click', '.baz', myCallback3); | |
// performant | |
$(document).on('submit', '#foo', myCallback1) | |
.on('submit', '#bar', myCallback2) | |
.on('click', '.baz', myCallback3); | |
// also performant | |
$document = $(document); | |
$document.on('submit', '#foo', myCallback1); | |
$document.on('submit', '#bar', myCallback2); | |
$document.on('click', '.baz', myCallback3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment