Edit this page

up.fragment up.extract(target, html, [options])
JavaScript function

This feature has been deprecated. Use up.render() or up.navigate() instead.

Load unpoly-migrate.js to polyfill deprecated features.

Updates a selector on the current page with the same selector from the given HTML string.

Example

Let's say your current 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 .one was discarded, since it didn't match the selector.


Parameters

target stringorElementorjQuery
html string
[options] Object optional

See options for up.render().

Return value

A promise that will be fulfilled when the selector was updated.