Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The issue with doing it this way is that you're making the CSS processor doing unnecessary work. If you are writing:

    div#sidebar > form#login-form input
then you are actually searching for input, then #login-form, then form, then #sidebar, then div. It adds up on a really big site. If you had just written

    #login-form input
you get the same selection without the additional processing. Even if you want to track the full "stack", don't use those extra tag qualifiers.

    #sidebar > #login-form input
is much better than what you've got.

Good source: http://code.google.com/speed/page-speed/docs/rendering.html



Why the hell doesn't the lookup code work left-to-right, like you write CSS? Is there a good reason, or is it just there to make you eschew best practices after you learn them?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: