我已經完成了a test與性能的jQuery選擇器。選擇器的性能
兩個選擇我已經測試:
selection_width = total_width - ($('#commands .minimap').outerWidth() + $('#commands .actions').outerWidth());
和:
var commands = $('#commands');
selection_width = total_width - ($('.minimap', commands).outerWidth() + $('.actions', commands).outerWidth());
第二個比第一種方法更快。這是正確的還是我搞砸了測試的地方?
您忽略了,命令保存。 – gdoron 2012-01-01 21:22:50