Skip to content

Commit 65c4f34

Browse files
committed
Merge branch 'fix-trailing-hash'
Closes #506
2 parents 94d1911 + ad02f0a commit 65c4f34

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

jquery.pjax.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ function pjax(options) {
226226
}
227227

228228
var url = parseURL(settings.url)
229-
url.hash = hash
229+
if (hash) url.hash = hash
230230
options.requestUrl = stripInternalParams(url.href)
231231
}
232232

test/unit/pjax.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ if ($.support.pjax) {
205205
})
206206
})
207207

208-
asyncTest("GET data is appended to query string", 5, function() {
208+
asyncTest("GET data is appended to query string", 6, function() {
209209
var data = { foo: 1, bar: 2 }
210210

211211
navigate(this.frame)
@@ -226,10 +226,11 @@ if ($.support.pjax) {
226226
// URL is set immediately
227227
equal(frame.location.pathname, "/env.html")
228228
equal(frame.location.search, "?foo=1&bar=2")
229+
equal(frame.location.href.indexOf("#"), -1)
229230
}, 0)
230231
})
231232

232-
asyncTest("GET data is merged into query string", 5, function() {
233+
asyncTest("GET data is merged into query string", 6, function() {
233234
var data = { bar: 2 }
234235

235236
navigate(this.frame)
@@ -250,6 +251,7 @@ if ($.support.pjax) {
250251
// URL is set immediately
251252
equal(frame.location.pathname, "/env.html")
252253
equal(frame.location.search, "?foo=1&bar=2")
254+
equal(frame.location.href.indexOf("#"), -1)
253255
}, 0)
254256
})
255257

test/unit/pjax_fallback.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ asyncTest("scrolls to anchor at top page"+s, function() {
141141

142142
if (disabled) {
143143
equal(frame.location.pathname, "/home.html")
144-
equal(frame.location.hash, "")
144+
equal(frame.location.href.indexOf("#"), -1)
145145
} else {
146146
equal(frame.location.pathname, "/anchor.html")
147147
equal(frame.location.hash, "#top")

0 commit comments

Comments
 (0)