How to make other JS libraries work with maquette js?

184 views Asked by At

We want to use maquette in an existing system. What's the best practice on making other 3rd party libraries (eg select2, bootstrap tooltip that modifies the DOM in place) play well within maquette?

1

There are 1 answers

0
Johan Gorter On BEST ANSWER

Although the question is broad, there is a simple answer. Maquette provides the aftercreate and afterupdate callbacks that can be used to modify the DOM that maquette created/updated. You can use the element argument to invoke the 3rd party library.

Maquette won't mind if the DOM nodes are modified by the 3rd party library. As long as they are not completely removed or replaced it should work fine. There is also the afterremoved callback that can be used to destroy the widget/component/whatever properly.