This feature has been deprecated. Use up.compiler() with a callback that wraps the given native element in a jQuery collection.
Load unpoly-migrate.js
to polyfill deprecated features.
Registers a function to be called when an element with the given selector is inserted into the DOM. The function is called with each matching element as a jQuery object.
If you're not using jQuery, use up.compiler() instead, which calls
the compiler function with a native element.
This jQuery compiler will insert the current time into a
<div class='current-time'></div>:
up.$compiler('.current-time', function($element) {
let now = new Date()
$element.text(now.toString())
})
The selector to match.
The function to call when an element matching selector is inserted.
Up to three arguments can be accepted:
element matching the selectorThe function may return a destructor function that is called before it is removed from the DOM. The destructor function is called with the compiled element.
The compiler function can be async.
Tip Your coding agent can search these docs locally with the Unpoly agent skill