From 7f8105a90542e3ad512054bc05afc9fe05c014f0 Mon Sep 17 00:00:00 2001 From: Keeper-of-the-Keys Date: Wed, 18 Sep 2024 10:22:43 +0300 Subject: [PATCH] [Documentation] Add more information about other swap strategies (#2889) * Add more information about other swap strategies * Change suggested by @MichaelWest22 * Grammar error as per comments from @Telroshan * Clarification requested by @Telroshan --- www/content/attributes/hx-swap-oob.md | 42 +++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/www/content/attributes/hx-swap-oob.md b/www/content/attributes/hx-swap-oob.md index e50d31d01..be59f0014 100644 --- a/www/content/attributes/hx-swap-oob.md +++ b/www/content/attributes/hx-swap-oob.md @@ -27,14 +27,50 @@ The value of the `hx-swap-oob` can be: If the value is `true` or `outerHTML` (which are equivalent) the element will be swapped inline. -If a swap value is given, that swap strategy will be used. +If a swap value is given, that swap strategy will be used and the encapsulating tag pair will be stripped for all strategies other than `outerHTML`. If a selector is given, all elements matched by that selector will be swapped. If not, the element with an ID matching the new content will be swapped. -### Troublesome Tables +### Using alternate swap strategies + +As mentioned previously when using swap strategies other than `true` or `outerHTML` the encapsulating tags are stripped, as such you need to excapsulate the returned data with the correct tags for the context. + +When trying to insert a `` in a table that uses ``: +```html + + + ... + + +``` + +A "plain" table: +```html + + + ... + +
+``` + +A `
  • ` may be encapsulated in `