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.
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, ...})
inscripts/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.