See this jsPerf test.
The most performant way to store data related to a certain element is to use a Map. Besides being the fastest, it also allows you to store arbitraty data. Using dataset and data-* attributes only allow for string values.
See this jsPerf test.
The most performant way to store data related to a certain element is to use a Map. Besides being the fastest, it also allows you to store arbitraty data. Using dataset and data-* attributes only allow for string values.