Every page that Swappit loads as a target must contain elements with the sameDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/soyleninjs/swappit/llms.txt
Use this file to discover all available pages before exploring further.
data-[handle]-update attribute names as the source page. Swappit matches regions by name, not by position or element type — only named regions that exist on both pages are updated.
Matching Regions by Name
The following example shows a source page and a target page using the handleapp.
Source page (index.html)
app.update('./about.html'):
header— replaced with the new content from the target page.content— replaced with the new content from the target page.sidebar— not found in the target page, so the classhiddenis added to the source element.footer— exists only in the target page, not the current DOM, so it is ignored entirely.
Update Order
By default, Swappit updates all matched regions in document order. You can control the sequence using thedata-[handle]-update-order attribute. Elements with this numeric attribute are updated first, sorted ascending by value. Elements without it are updated last.
Duplicate Region Names
Target Pages Don’t Need to Be Full Documents
Target pages can be either complete HTML documents or bare HTML fragments. Swappit uses the browser’s built-inDOMParser to parse the response text, so a minimal fragment like the following is perfectly valid:
URL Validation
Swappit only accepts relative URLs that begin with/ or ./. External URLs and relative paths that use ../ are rejected with an error.
update(), preloadContents(), and the href attribute on links with data-swappit-handle.