up.extract(selectorOrElement, html, [options])
Updates a selector on the current page with the same selector from the given HTML string.
Let's say your curent HTML looks like this:
<div class="one">old one</div> <div class="two">old two</div>
We now replace the second
<div>, using an HTML string
as the source:
html = '<div class="one">new one</div>' + '<div class="two">new two</div>'; up.extract('.two', html);
Unpoly looks for the selector
.two in the strings and updates its
contents in the current page. The current page now looks like this:
<div class="one">old one</div> <div class="two">new two</div>
Note how only
.two has changed. The update for
discarded, since it didn't match the selector.
See options for
A promise that will be resolved then the selector was updated and all animation has finished.