@@ -4638,18 +4638,18 @@ var htmx = (function() {
46384638
46394639 let push = xhr . getResponseHeader ( 'HX-Push' ) || xhr . getResponseHeader ( 'HX-Push-Url' )
46404640 let replace = xhr . getResponseHeader ( 'HX-Replace-Url' )
4641+ const headerPath = push || replace
46414642
46424643 // if there was a response header, that has priority
4643- if ( ! push && ! replace ) {
4644+ if ( ! headerPath ) {
46444645 // Next resolve via DOM values
46454646 push = getClosestAttributeValue ( elt , 'hx-push-url' ) || etc . push
46464647 replace = getClosestAttributeValue ( elt , 'hx-replace-url' ) || etc . replace
46474648 if ( ! push && ! replace && getInternalData ( elt ) . boosted ) {
46484649 push = 'true'
46494650 }
46504651 }
4651-
4652- let path = push || replace
4652+ let path = headerPath || push || replace
46534653 // unset or false indicates no push, return empty object
46544654 if ( ! path || path === 'false' ) {
46554655 return { }
@@ -4659,8 +4659,8 @@ var htmx = (function() {
46594659 if ( path === 'true' ) {
46604660 path = pathInfo . responsePath || pathInfo . finalRequestPath // if there is no response path, go with the original request path
46614661 }
4662- // restore any anchor associated with the request
4663- if ( pathInfo . anchor && path . indexOf ( '#' ) === - 1 ) {
4662+ // restore any anchor associated with the request except for paths from respone headers to keep old behaviour
4663+ if ( ( ! headerPath || headerPath === 'true' ) && pathInfo . anchor && path . indexOf ( '#' ) === - 1 ) {
46644664 path = path + '#' + pathInfo . anchor
46654665 }
46664666
0 commit comments