Fix bugs and add tests (#145)
* Fix bug when checking if elements were parsed already
parse-element.js checks if the element was already parsed by
checking for the `data-pjax-click-state` attribute. However, this
attribute was not added until the link is clicked.
Originally, there was a separate attribute, `data-pjax-enabled`,
which tracked if the element was parsed already, but that was
changed in 9a86044.
This commit merges the attributes for mouse clicks and key presses
into one and adds that attribute when the element is initially
parsed.
* More bug fixes
* Fix documentation for currentUrlFullReload
* Ignore lines from coverage if they can't be tested
* Refactor attach-link and attach-form
* Fix and refactors tests
* Add tests
* Add TS definitions for options.requestOptions
* Code cleanup
This commit was merged in pull request #145.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user