HTML data-*-attributes

Since I’m working with a server-side programming language (PHP), JavaScript and HTML I’ve been dealing with a way to separate logic, structure and presentation layer. Especially when you work on projects that have a lot of frontend logic. There’s always a need for change late in the project in either one of them. When you have to change the structure or the representation layer you will mess up your logic when there’s no clean separation and the other way around. With the html data-*-attribute things get much easier. It solves the problem of how to pass data from your server to the frontend, helps avoiding mixing up style definitions and frontend logic (class-attributes) and gives your frontend data a home. Continue reading