CSS Performance between class and attribute selectors

前端 未结 4 1459
我寻月下人不归
我寻月下人不归 2021-01-04 07:47

I\'m wondering if there is a performance issue using attribute selectors instead of class selectors.

div.test {}
div[test] {}

P.S. : I\

4条回答
  •  执笔经年
    2021-01-04 08:30

    According to this project there is no real performance issue.

    This surprised us, since selector performance hasn't been a real concern in our day-to-day work for a while. Front-end performance is a huge deal, of course, but CSS selectors appear to contribute such a minuscule amount to the total page load time that it didn't occur to us that it might be a major concern to many people.

    They have benchmarks as well.

    https://github.com/amcss/am-benchmarks

提交回复
热议问题