Skip to content

Instantly share code, notes, and snippets.

@luciopaiva
Last active June 3, 2017 23:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luciopaiva/dbaa51d88d1e24896a0703e5b575f305 to your computer and use it in GitHub Desktop.
Save luciopaiva/dbaa51d88d1e24896a0703e5b575f305 to your computer and use it in GitHub Desktop.
Storing data in HTML elements

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment