@@ -281,7 +281,7 @@ var htmx = (function() {
281281 */
282282 historyRestoreAsHxRequest : true ,
283283 /**
284- * Weather to report input validation errors to the end user and update focus to the first input that fails validation.
284+ * Whether to report input validation errors to the end user and update focus to the first input that fails validation.
285285 * This should always be enabled as this matches default browser form submit behaviour
286286 * @type boolean
287287 * @default false
@@ -297,7 +297,7 @@ var htmx = (function() {
297297 location,
298298 /** @type {typeof internalEval } */
299299 _ : null ,
300- version : '2.0.7 '
300+ version : '2.0.8 '
301301 }
302302 // Tsc madness part 2
303303 htmx . onLoad = onLoadHelper
@@ -526,6 +526,9 @@ var htmx = (function() {
526526 * @returns {Document }
527527 */
528528 function parseHTML ( resp ) {
529+ if ( 'parseHTMLUnsafe' in Document ) {
530+ return Document . parseHTMLUnsafe ( resp )
531+ }
529532 const parser = new DOMParser ( )
530533 return parser . parseFromString ( resp , 'text/html' )
531534 }
@@ -3127,7 +3130,7 @@ var htmx = (function() {
31273130 //= ===================================================================
31283131 // History Support
31293132 //= ===================================================================
3130- let currentPathForHistory = location . pathname + location . search
3133+ let currentPathForHistory
31313134
31323135 /**
31333136 * @param {string } path
@@ -3139,6 +3142,8 @@ var htmx = (function() {
31393142 }
31403143 }
31413144
3145+ setCurrentPathForHistory ( location . pathname + location . search )
3146+
31423147 /**
31433148 * @returns {Element }
31443149 */
@@ -4074,7 +4079,10 @@ var htmx = (function() {
40744079 targetOverride : resolvedTarget ,
40754080 swapOverride : context . swap ,
40764081 select : context . select ,
4077- returnPromise : true
4082+ returnPromise : true ,
4083+ push : context . push ,
4084+ replace : context . replace ,
4085+ selectOOB : context . selectOOB
40784086 } )
40794087 }
40804088 } else {
@@ -4689,8 +4697,8 @@ var htmx = (function() {
46894697 const requestPath = responseInfo . pathInfo . finalRequestPath
46904698 const responsePath = responseInfo . pathInfo . responsePath
46914699
4692- const pushUrl = getClosestAttributeValue ( elt , 'hx-push-url' )
4693- const replaceUrl = getClosestAttributeValue ( elt , 'hx-replace-url' )
4700+ const pushUrl = responseInfo . etc . push || getClosestAttributeValue ( elt , 'hx-push-url' )
4701+ const replaceUrl = responseInfo . etc . replace || getClosestAttributeValue ( elt , 'hx-replace-url' )
46944702 const elementIsBoosted = getInternalData ( elt ) . boosted
46954703
46964704 let saveType = null
@@ -4809,19 +4817,17 @@ var htmx = (function() {
48094817 }
48104818
48114819 if ( hasHeader ( xhr , / H X - L o c a t i o n : / i) ) {
4812- saveCurrentPageToHistory ( )
48134820 let redirectPath = xhr . getResponseHeader ( 'HX-Location' )
4814- /** @type {HtmxAjaxHelperContext&{path:string} } */
4815- var redirectSwapSpec
4821+ /** @type {HtmxAjaxHelperContext&{path? :string} } */
4822+ var redirectSwapSpec = { }
48164823 if ( redirectPath . indexOf ( '{' ) === 0 ) {
48174824 redirectSwapSpec = parseJSON ( redirectPath )
48184825 // what's the best way to throw an error if the user didn't include this
48194826 redirectPath = redirectSwapSpec . path
48204827 delete redirectSwapSpec . path
48214828 }
4822- ajaxHelper ( 'get' , redirectPath , redirectSwapSpec ) . then ( function ( ) {
4823- pushUrlIntoHistory ( redirectPath )
4824- } )
4829+ redirectSwapSpec . push = redirectSwapSpec . push || 'true'
4830+ ajaxHelper ( 'get' , redirectPath , redirectSwapSpec )
48254831 return
48264832 }
48274833
@@ -4920,7 +4926,7 @@ var htmx = (function() {
49204926 selectOverride = xhr . getResponseHeader ( 'HX-Reselect' )
49214927 }
49224928
4923- const selectOOB = getClosestAttributeValue ( elt , 'hx-select-oob' )
4929+ const selectOOB = etc . selectOOB || getClosestAttributeValue ( elt , 'hx-select-oob' )
49244930 const select = getClosestAttributeValue ( elt , 'hx-select' )
49254931
49264932 swap ( target , serverResponse , swapSpec , {
@@ -5119,7 +5125,7 @@ var htmx = (function() {
51195125 "[hx-trigger='restored'],[data-hx-trigger='restored']"
51205126 )
51215127 body . addEventListener ( 'htmx:abort' , function ( evt ) {
5122- const target = evt . target
5128+ const target = ( /** @type { CustomEvent } */ ( evt ) ) . detail . elt || evt . target
51235129 const internalData = getInternalData ( target )
51245130 if ( internalData && internalData . xhr ) {
51255131 internalData . xhr . abort ( )
@@ -5239,6 +5245,9 @@ var htmx = (function() {
52395245 * @property {Object|FormData } [values]
52405246 * @property {Record<string,string> } [headers]
52415247 * @property {string } [select]
5248+ * @property {string } [push]
5249+ * @property {string } [replace]
5250+ * @property {string } [selectOOB]
52425251 */
52435252
52445253/**
@@ -5285,6 +5294,9 @@ var htmx = (function() {
52855294 * @property {Object|FormData } [values]
52865295 * @property {boolean } [credentials]
52875296 * @property {number } [timeout]
5297+ * @property {string } [push]
5298+ * @property {string } [replace]
5299+ * @property {string } [selectOOB]
52885300 */
52895301
52905302/**
0 commit comments