Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

warn for repeated queries in the same scope, suggest caching selector results #6

Open
jokeyrhyme opened this issue Dec 9, 2013 · 1 comment

Comments

@jokeyrhyme
Copy link
Owner

Don't:

$('button').prop('disable', false);
$('button').css('background-color', 'red');

Do:

var button$ = $('button');
button$.prop('disable', false);
button$.css('background-color', 'red');

Avoiding repeat queries is good for performance / UI-responsiveness.

@jokeyrhyme
Copy link
Owner Author

It's difficult to make this an error, as there are potentially legitimate uses for repeat queries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant