A lot of Bootstrap plugins are immediately working if some data-*="xzy"
attributes are added (interactively).
E.g. just add data-toggle="collapse"
to an anchor tag and Bootstrap Collapse is present, see demo https://jsfiddle.net/4n5zrkpb/.
I want to know:
- What's the technology behind? (As far as I know they don't listen to mutation events and don't use
MutationObserver
.) - Can I use it on my own ;-)
UPDATE: I don't want Event binding on dynamically created elements?. I originally wanted to be updated when new elements has been created dynamically! But the Bootstrap way is far more easy and backward compatible: Notify only if some user interaction (e.g listen to all click events) took place.