Are data attribute css selectors faster than class selectors?

前端 未结 4 1545
眼角桃花
眼角桃花 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:48

    I wouldn't call it conclusive, but it does appear class selectors are faster... I just put this together for a quickie test.

    http://jsperf.com/data-selector-performance

    EDIT:

    Based on Vlad's and my jsperf tests... if performance is a concern (especially IE)... classes are still the way to go

提交回复
热议问题