Skip to content

Commit

Permalink
Fix format
Browse files Browse the repository at this point in the history
  • Loading branch information
Telroshan committed Dec 12, 2024
1 parent c3b1c59 commit 7ef99a9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/htmx.js
Original file line number Diff line number Diff line change
Expand Up @@ -2370,7 +2370,7 @@ var htmx = (function() {
path = getDocument().location.href
}
if (verb === 'get' && path.includes('?')) {
path = path.replace(/\?[^#]+/, '');
path = path.replace(/\?[^#]+/, '')
}
}
triggerSpecs.forEach(function(triggerSpec) {
Expand Down
26 changes: 12 additions & 14 deletions test/attributes/hx-boost.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,17 +157,16 @@ describe('hx-boost attribute', function() {
})

it('form get with no action properly clears existing parameters on submit', function() {

/// add a foo=bar to the current url
var path = location.href;
if (!path.includes("foo=bar")) {
if (!path.includes("?")) {
path += "?foo=bar";
var path = location.href
if (!path.includes('foo=bar')) {
if (!path.includes('?')) {
path += '?foo=bar'
} else {
path += "&foo=bar";
path += '&foo=bar'
}
}
history.replaceState({ htmx: true }, '', path);
history.replaceState({ htmx: true }, '', path)

this.server.respondWith('GET', /\/*/, function(xhr) {
// foo should not be present because the form is a get with no action
Expand All @@ -183,17 +182,16 @@ describe('hx-boost attribute', function() {
})

it('form get with an empty action properly clears existing parameters on submit', function() {

/// add a foo=bar to the current url
var path = location.href;
if (!path.includes("foo=bar")) {
if (!path.includes("?")) {
path += "?foo=bar";
var path = location.href
if (!path.includes('foo=bar')) {
if (!path.includes('?')) {
path += '?foo=bar'
} else {
path += "&foo=bar";
path += '&foo=bar'
}
}
history.replaceState({ htmx: true }, '', path);
history.replaceState({ htmx: true }, '', path)

this.server.respondWith('GET', /\/*/, function(xhr) {
// foo should not be present because the form is a get with no action
Expand Down

0 comments on commit 7ef99a9

Please sign in to comment.