Is this source code ILLEGAL?!! Maybe in Missouri. In this tutorial, you will learn how and why we can use the Javascript dataset property to store data inside of an HTML element without displaying it in the browser. You will also learn how the Missouri Governor wanted to prosecute a reporter for viewing the HTML source code on a website.
???? Subscribe ➜ https://bit.ly/3nGHmNn
???? This tutorial is part of an Advanced Javascript Concepts tutorial series playlist:
https://www.youtube.com/playlist?list=PL0Zuz27SZ-6N3bG4YZhkrCL3ZmDcLTuGd
DO NOT use innerHTML - 2 BIG Reasons Why | Javascript Optimization Tips
(00:00) Intro
(00:09) Welcome
(00:16) The Backstory: Illegal Source Code in Missouri?!
(01:41) Why and how to store hidden data in HTML elements
(07:37) How to retrieve data from a dataset with Javascript
(10:42) Can we really "decode the HTML"?
(11:40) Creating a decode the HTML function
(15:17) An Easier Way: the he package
???? Referenced Tutorials:
Don't Use forEach with Async/Await: https://youtu.be/4lqJBBEpjRE
2 BIG Reasons to avoid using innerHTML: https://youtu.be/ILcu32Nkq_I
Get Started with Node.js: https://youtu.be/JZXQ455OT3A
Learn about NPM Modules: https://youtu.be/oGO_-DWTmKA
???? References:
MDN "Using data attributes": https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes
MDN DOMParser: https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString
List of HTML Entities: https://unicode-table.com/en/html-entities/
NPM he package: https://www.npmjs.com/package/he
CDNJS he package: https://cdnjs.com/libraries/he
✅ Follow Me:
Twitter: https://twitter.com/yesdavidgray
LinkedIn: https://www.linkedin.com/in/davidagray/
Blog: https://yesdavidgray.com
Reddit: https://www.reddit.com/user/DaveOnEleven
Was this tutorial about how and why to store data attributes in HTML and retrieve the data with Javascript helpful? If so, please share. Let me know your thoughts in the comments.
#javascript #dataset #html