对于单个 jQuery 选择器,使用 id 而不是 class 的速度有多快?

How faster is using id instead of class for single jQuery selectors?

我经常使用 .class 到 select 单个 html 元素。然而,这是不正确的。我在某处读到,使用 #id 是使用 jQuery 时的最佳方法。尝试 select 单个元素时,使用 #id.class 快多少?

根据此 link that taken from ewwink's answer,是的,在任何常见浏览器中,通过 ID 选择都比单个 class 快。