jquery - Does the length of the selector affect the speed? -
so in cases better code readability use div#parent div.someclass a
, can div.someclass a
. version better , faster?
it's important when using jquery consider selectors have converted native browser functions @ end of day. means should try use id or tag based selectors whenever possible. recommend using $("div#parent").find("div.someclass a")
better performance
this gives better performance since use optimized tag/id selector parent, , slower class based selector applied more limited set since applied descendants of specified parent.
Comments
Post a Comment