Update JavaScript components of the Design System website so they can be used with the createAll
function
#3812
Labels
javascript
Pull requests that update Javascript code
What
Update the JavaScript components of the Design System website and their initialisation so they're instantiated by
createAll
calls rather than manualdocument.querySelector[All]
andnew
calls.As we do this, there's a couple of tidy ups that we should do:
OptionsTable
andNavigation
are not attached to any element. It's worth looking at whether they depend on a specific root (their names make it sound like they could) and if so if they can be updated to be initialised on a specific elementdata-module
used by theExample
component does not match the component name. For consistency, better to make them matchCode
component gets instanciated on the<pre>
inside the element withdata-module
. It should be the responsibility of theCode
component to find that<pre>
(and throw in a similar fashion as the components in the Design System)Search
,BackToTop
andCookiePage
usedocument.querySelector
rather thatquerySelectorAll
as there's only one in the page. There shouldn't be any harm in switching tocreateAll
(which usesquerySelectorAll
). If components really need to be instanciated only once, we could have them throw in theirconstructor
Why
This will make the initialisation code more consistent as well as give us a safe way to explore how
createAll
could work for other components than those in the Design System itself.Who needs to work on this
Developers
Who needs to review this
Developers
Done when
createAll
The text was updated successfully, but these errors were encountered: