ㅇㅎ class 가 확실히 빠르긴 하구나 ㅎㅎ..

r·2021년 7월 27일
0

class attribute, you can benefit from native getElementsByClassName searching (with O(1) time complexity) and classList object for toggling, adding and removing class. There's nothing like getElementsByAttributeValue.

There is relatively slower Element.querySelectorAll('[data-attr="value"]') ref See Oliver Moran's comment. It has O(n) time complexity.

profile
프론트엔드 개발자를 꿈꿉니다.

0개의 댓글