It is OK leave removal of tag from DOM to another library?

49 views Asked by At

I'm testing riot with isotope.js. I add tags to an isotope container and when I want to remove them with collapsing animation I call isotope command "remove". This command removes the DOM object and I don't get a riot 'unmout' event which is fine as I don't need to remove any subscriptions/listeners etc.

I actually wrote my code to trap event "removeCompleted" triggered by isotope so that I would ask the tag to unmount itself but I realized the tag doesn't exist anymore at that point.

But is there any problem in using riot this way or should I aim for a proper tag lifecycle?

2

There are 2 answers

0
mayama takeshi On

Sorry, I was not paying attention: removeCompleted will provide the list of removedItems (I was checking presence of the items using $("mytag") in the console) The tags were removed from DOM but not destroyed. So I just need to call unmount() on each item mentioned in the list and tag lifecycle will be respected.

0
Ricardo Malias On

Answering specifically your question, there's no problem to mix riot.js with other libraries like your example isotope.js ...

He is not too much intrusive and you can mix with a lot of other libraries. But avoid use other libraries that do the same as riot.js do.