@@ -280,7 +280,7 @@ var htmx = (function() {
280280 */
281281 historyRestoreAsHxRequest : true ,
282282 /**
283- * Weather to report input validation errors to the end user and update focus to the first input that fails validation.
283+ * Whether to report input validation errors to the end user and update focus to the first input that fails validation.
284284 * This should always be enabled as this matches default browser form submit behaviour
285285 * @type boolean
286286 * @default false
@@ -296,7 +296,7 @@ var htmx = (function() {
296296 location,
297297 /** @type {typeof internalEval } */
298298 _ : null ,
299- version : '2.0.7 '
299+ version : '2.0.8 '
300300 }
301301 // Tsc madness part 2
302302 htmx . onLoad = onLoadHelper
@@ -525,6 +525,9 @@ var htmx = (function() {
525525 * @returns {Document }
526526 */
527527 function parseHTML ( resp ) {
528+ if ( 'parseHTMLUnsafe' in Document ) {
529+ return Document . parseHTMLUnsafe ( resp )
530+ }
528531 const parser = new DOMParser ( )
529532 return parser . parseFromString ( resp , 'text/html' )
530533 }
@@ -3126,7 +3129,7 @@ var htmx = (function() {
31263129 //= ===================================================================
31273130 // History Support
31283131 //= ===================================================================
3129- let currentPathForHistory = location . pathname + location . search
3132+ let currentPathForHistory
31303133
31313134 /**
31323135 * @param {string } path
@@ -3138,6 +3141,8 @@ var htmx = (function() {
31383141 }
31393142 }
31403143
3144+ setCurrentPathForHistory ( location . pathname + location . search )
3145+
31413146 /**
31423147 * @returns {Element }
31433148 */
@@ -4073,7 +4078,10 @@ var htmx = (function() {
40734078 targetOverride : resolvedTarget ,
40744079 swapOverride : context . swap ,
40754080 select : context . select ,
4076- returnPromise : true
4081+ returnPromise : true ,
4082+ push : context . push ,
4083+ replace : context . replace ,
4084+ selectOOB : context . selectOOB
40774085 } )
40784086 }
40794087 } else {
@@ -4688,8 +4696,8 @@ var htmx = (function() {
46884696 const requestPath = responseInfo . pathInfo . finalRequestPath
46894697 const responsePath = responseInfo . pathInfo . responsePath
46904698
4691- const pushUrl = getClosestAttributeValue ( elt , 'hx-push-url' )
4692- const replaceUrl = getClosestAttributeValue ( elt , 'hx-replace-url' )
4699+ const pushUrl = responseInfo . etc . push || getClosestAttributeValue ( elt , 'hx-push-url' )
4700+ const replaceUrl = responseInfo . etc . replace || getClosestAttributeValue ( elt , 'hx-replace-url' )
46934701 const elementIsBoosted = getInternalData ( elt ) . boosted
46944702
46954703 let saveType = null
@@ -4808,19 +4816,17 @@ var htmx = (function() {
48084816 }
48094817
48104818 if ( hasHeader ( xhr , / H X - L o c a t i o n : / i) ) {
4811- saveCurrentPageToHistory ( )
48124819 let redirectPath = xhr . getResponseHeader ( 'HX-Location' )
4813- /** @type {HtmxAjaxHelperContext&{path:string} } */
4814- var redirectSwapSpec
4820+ /** @type {HtmxAjaxHelperContext&{path? :string} } */
4821+ var redirectSwapSpec = { }
48154822 if ( redirectPath . indexOf ( '{' ) === 0 ) {
48164823 redirectSwapSpec = parseJSON ( redirectPath )
48174824 // what's the best way to throw an error if the user didn't include this
48184825 redirectPath = redirectSwapSpec . path
48194826 delete redirectSwapSpec . path
48204827 }
4821- ajaxHelper ( 'get' , redirectPath , redirectSwapSpec ) . then ( function ( ) {
4822- pushUrlIntoHistory ( redirectPath )
4823- } )
4828+ redirectSwapSpec . push = redirectSwapSpec . push || 'true'
4829+ ajaxHelper ( 'get' , redirectPath , redirectSwapSpec )
48244830 return
48254831 }
48264832
@@ -4919,7 +4925,7 @@ var htmx = (function() {
49194925 selectOverride = xhr . getResponseHeader ( 'HX-Reselect' )
49204926 }
49214927
4922- const selectOOB = getClosestAttributeValue ( elt , 'hx-select-oob' )
4928+ const selectOOB = etc . selectOOB || getClosestAttributeValue ( elt , 'hx-select-oob' )
49234929 const select = getClosestAttributeValue ( elt , 'hx-select' )
49244930
49254931 swap ( target , serverResponse , swapSpec , {
@@ -5118,7 +5124,7 @@ var htmx = (function() {
51185124 "[hx-trigger='restored'],[data-hx-trigger='restored']"
51195125 )
51205126 body . addEventListener ( 'htmx:abort' , function ( evt ) {
5121- const target = evt . target
5127+ const target = ( /** @type { CustomEvent } */ ( evt ) ) . detail . elt || evt . target
51225128 const internalData = getInternalData ( target )
51235129 if ( internalData && internalData . xhr ) {
51245130 internalData . xhr . abort ( )
@@ -5238,6 +5244,9 @@ var htmx = (function() {
52385244 * @property {Object|FormData } [values]
52395245 * @property {Record<string,string> } [headers]
52405246 * @property {string } [select]
5247+ * @property {string } [push]
5248+ * @property {string } [replace]
5249+ * @property {string } [selectOOB]
52415250 */
52425251
52435252/**
@@ -5284,6 +5293,9 @@ var htmx = (function() {
52845293 * @property {Object|FormData } [values]
52855294 * @property {boolean } [credentials]
52865295 * @property {number } [timeout]
5296+ * @property {string } [push]
5297+ * @property {string } [replace]
5298+ * @property {string } [selectOOB]
52875299 */
52885300
52895301/**
0 commit comments