Edit this page

up.fragment [up-source]
HTML selector

When Unpoly inserts a fragment, the [up-source] attribute is automatically set to the URL from which the fragment's HTML was loaded.

When an element is reloaded or polled, Unpoly will request the URL from the closest [up-source] attribute.

The [up-source] attribute is only set for GET requests.

Using an explicit source URL

To indicate a different source URL for a fragment (and its descendants), manually set [up-source] attribute:

<div class="unread-count" up-poll up-source="/unread-count"> <!-- mark: up-source -->
  2 new messages
</div>

When such an [up-source] attribute is explicitly set in the HTML, Unpoly will not overwrite it on insertion.

Accessing the source URL from JavaScript

To retrieve the source URL from JavaScript, use up.fragment.source().


Modifying attributes

up-source
required

The URL from which this element and its descendants were initially requested.

string