Are data attribute css selectors faster than class selectors?

前端 未结 4 1552
眼角桃花
眼角桃花 2020-12-01 04:32

A few months ago this article pointed out that classes could actually be avoided all together from website development.

My question is, how efficient are the data s

4条回答
  •  长情又很酷
    2020-12-01 04:50

    After checking out BLSully's answer and the test page he provided, here are the actual figures for comparison.

    jQuery class selector performance vs jQuery data attribute selector performance operations per second:

    • 31% faster in Chrome 27.0.1453
    • 140% faster in Firefox 15.0.1
    • 131% faster in Firefox 21.0
    • 1,267% faster in IE 9.0
    • 1,356% faster in IE 10.0

提交回复
热议问题