fix manual anchor test

This commit is contained in:
Carson Gross 2024-01-25 20:08:27 -07:00
parent cf3ece96ab
commit 1e211eee87

View File

@ -1289,7 +1289,7 @@ var htmx = (function() {
}) })
if (swapOptions.anchor) { if (swapOptions.anchor) {
const anchorTarget = resolveTarget(swapOptions.anchor) const anchorTarget = resolveTarget("#" + swapOptions.anchor)
if (anchorTarget) { if (anchorTarget) {
anchorTarget.scrollIntoView({ block: 'start', behavior: 'auto' }) anchorTarget.scrollIntoView({ block: 'start', behavior: 'auto' })
} }
@ -3566,8 +3566,7 @@ var htmx = (function() {
} }
// restore any anchor associated with the request // restore any anchor associated with the request
if (responseInfo.pathInfo.anchor && if (responseInfo.pathInfo.anchor && path.indexOf('#') === -1) {
path.indexOf('#') === -1) {
path = path + '#' + responseInfo.pathInfo.anchor path = path + '#' + responseInfo.pathInfo.anchor
} }