How .livequery()
works
.livequery()
has two uses:
- when you pass event type as the first argument,
- when you pass callback (function) as the first argument,
In the first case you are completely able to replace it with currently used .on()
or already deprecated .delegate()
of .live()
(if you have version of jQuery older than 1.7).
In the second case it looks like .livequery()
overrides standard DOM modification JS methods, or "hooks" itself into them. To mimic that behaviour you will need to do something similar or just redesign your script to avoid that obstacle.
In case you choose using your own implementation, just make sure you don't make the same mistake as .live()
developers did: move selector from the jQuery argument into your module's function's argument: jQuery(selector).live(...)
-> jQuery(...).on(..., selector, ...)
, as does not need to be executed at the time you prepare your script (it is only executed when something changes).
Listening to new elements added into DOM
You are out of luck, because there are not widely adopted events responsible for listening to new DOM elements being inserted into DOM. The list of possible events you can use is here:
https://developer.mozilla.org/en/DOM_Client_Object_Cross-Reference/DOM_Events