3 ms·
Don’t do this: form#UserLogin {} ID selectors are unique; it just makes them less efficient as they don't need a tag name to go along with it. Classes aren't u
by mkopinsky 14y ago
Don’t do this:
form#UserLogin {}
ID selectors are unique; it just makes them less efficient as they don't need a tag name to go along with it. Classes aren't unique, but it’s a good idea to avoid this method on classes too.
Re: classes - at least in IEold, and at least with jQuery, I found that performance for a selector like table.foo was orders of magnitude faster than .foo (for a page with a too-large DOM). IEold does not have a native document.getElementsByClassName so jQuery was searching the entire DOM for a .foo. This may be different for CSS vs JS though.