Fix bugs and add tests #145

Merged
BehindTheMath merged 11 commits from fix/bugs-and-add-tests into master 2018-04-09 22:36:33 -05:00
2 changed files with 8 additions and 2 deletions
Showing only changes of commit dddb4dd2fb - Show all commits

View File

@@ -445,10 +445,14 @@ Enables verbose mode. Useful to debug page layout differences.
When set to true, clicking on a link that points to the current URL will trigger a full page reload.
The default is `false`, so clicking on such a link will do nothing.
When set to `false`, clicking on such a link will cause Pjax to load the
current page like any page.
If you want to add some custom behavior, add a click listener to the link,
and set `preventDefault` to true, to prevent Pjax from receiving the event.
Note: this must be done before Pjax is instantiated. Otherwise, Pjax's
event handler will be called first, and preventDefault() won't be called yet.
Here is some sample code:
```js
@@ -465,6 +469,8 @@ Here is some sample code:
}
})
}
var pjax = new Pjax()
```
(Note that if `cacheBust` is set to true, the code that checks if the href

View File

@@ -11,7 +11,7 @@
<h1>Index</h1>
Hello.
Go to <a href="page2.html" class="js-Pjax">Page 2</a> or <a href="page3.html" class="js-Pjax">Page 3</a> and view your console to see Pjax events.
Clicking on <a href="index.html">this page</a> will just reload the page entirely.
Clicking on <a href="index.html">this page</a> will do nothing.
<h2>Manual URL loading</h2>