Netcentric / cn-website

Apache License 2.0
2 stars 7 forks source link

JS: The Creation of Elements #375

Open tomasznetcentric opened 1 year ago

tomasznetcentric commented 1 year ago

In one of our last PRs we introduced a new function to create elements to our Franklin library.

It is createElement('htmlTag', ['css', 'classes', ...], {properties: value, ...}) in scripts/lib-franklin.js

View createElement() in action on blocks/chapter-cards/chapter-cards.js

This feature helps us to keep our code organized and tidy. Of course, this feature speeds up the development time for future scripts. And in order to keep our code base in one line we need to refactor the current approach to how we create the elements.

So let's find each document.createElement() and their followers like: .classList.add(), .setAttribute() .... and replace it with one sigle line.