Commit Graph

37 Commits

Author SHA1 Message Date
Behind The Math
e35b831228 Always clone the options object so we don't mutate the original 2018-04-25 21:15:59 -04:00
Behind The Math
1aebbcc502 Revert removing the JSCS enable comment 2018-04-22 18:25:26 -04:00
Behind The Math
59bd0fb595 Use the same options object in handle-response as in send-request
Instead of cloning this.options again in handle-response.js, pass
the options object from send-request.js. This way,
pjax.state.options will also have the request options.
2018-04-12 18:26:02 -04:00
Robin North
358b6f6836 Support multiple select fields in form submissions 2018-04-12 18:03:28 -04:00
BehindTheMath
d6bf21ed22 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
2018-04-09 23:36:32 -04:00
BehindTheMath
2166866967 Handle XHR response error (#137)
* Move the XHR callback to a separate file
* Trigger an error event if the response cannot be parsed.
* Add tests for handle-response.js
2018-03-15 16:12:32 -04:00
Robin North
05fa833169 loadUrl enhancements (#134)
`loadUrl` enhancements

- Make `options` parameter optional
- Allow partial overriding of instance options when calling `loadUrl` directly
- Make `requestOptions` optional
- Document `loadUrl` usage and provide examples
2018-03-06 10:06:38 +00:00
Robin North
07baae8e4d Fix form submission (#129)
* Fix check for radio and checkbox inputs

* Fix GET form submission

* Add example forms for testing

* Refactor query string building
2018-03-02 20:25:08 +00:00
BehindTheMath
a72880d205 Code cleanup (#120)
* Lots of code cleanup

* Cleanup parse-options tests
  - Rename objects for clarity and inline unneeded objects
  - Remove unneeded tests
  - Use Object.keys().length instead of a custom function
  - Use typeof === "object" instead of a custom function that checks the prototype tree as well, since we don't expect anything but an object literal.

* Remove old switchFallback code

* Remove polyfill for Function.prototype.bind

* Inline small functions

* Add more documentation and tests for options.currentUrlFullReload
  Closes #17

* Update package.json
2018-02-02 09:52:44 -05:00
Robin North
01fb72ceeb Simplify options assignment 2018-01-24 23:40:05 +00:00
Robin North
f642eec047 Preserve ability to disable analytics behavior, explicitly document this option 2018-01-24 23:38:34 +00:00
Robin North
cc384b9b16 Improve check for analytics function option 2018-01-24 23:35:45 +00:00
Robin North
f559ca2914 Cleanup default analytics function 2018-01-24 23:35:45 +00:00
BehindTheMath
8fcef04c9e Merge pull request #112 from timtrinidad/master
Use a local clone of options when initiating requests, so requestOptions don't persist
2018-01-23 15:44:26 -05:00
Tim Trinidad
526a0883a2 Clone options in attach-link to prevent requestOptions changes from persisting 2018-01-23 13:22:31 -05:00
Behind The Math
e7935d9c74 Add scrollRestoration option 2018-01-22 18:56:22 -05:00
Tim Trinidad
e4b3952589 Clone options before modifying it for form submissions 2018-01-22 18:32:28 -05:00
Robin North
cd09cc88d1 Replace instances of ES6 const keyword with var 2018-01-18 16:00:24 -05:00
Behind The Math
c0d64e41b8 Fix linting errors 2018-01-09 14:09:40 -05:00
BehindTheMath
6491e32437 Add an option to set a timeout for XHR requests (#95)
Closes #24.
2018-01-07 23:56:11 -05:00
Behind The Math
d3d5ef7a11 Pass the element that triggered Pjax to the pjax:send event
Closes #62.
2017-12-21 13:06:49 -05:00
Behind The Math
0781f820ee Add switchElementsAlt() to the default switches
Fixes #83.
2017-12-19 15:56:48 -05:00
markusfluer
86e5a2281a Added support do do a push-state ajax request with forms 2017-09-18 14:13:45 +02:00
Maxime Thirouin
eff7cfd452 Merge pull request #67 from compressed/refresh
Update refresh and handle attributes without values
2016-06-28 07:17:43 +02:00
Bart Nagel
7976f06043 Added: cacheBust option (#71)
* Refactor request test to allow further tests to be added

* Make cache-busting optional

Closes #70
2016-06-28 06:46:14 +02:00
Christopher Brickley
beaa21fb3a fix(refresh): use this.parseDOM for refresh
Fix for issue mentioned in #36
2016-04-19 12:13:14 -04:00
Maxime Thirouin
afe0ddb6b9 Fixed: `this.reload` is now a Function
Closes #65
2016-03-24 12:38:15 +01:00
COoL
e3d0f8cc1b fixed an error when using pjax with google analytics 2016-01-15 17:32:07 +08:00
darylteo
97c8b2d749 [NEW] #5 Ignore default prevented clicks 2016-01-04 23:19:36 +11:00
Maxime Thirouin
af8783587c refresh now accept an argument so you can refresh just a part of a page 2015-01-29 07:33:13 +01:00
Peter Lada
9a86044f90 changed existing refresh method to reload. changed the data check to trigger a refresh on the element based on the already bound data attr 2015-01-28 18:27:16 -08:00
Peter Lada
e6a35f38e4 attach data to pjaxified links so they can't be pjaxified twice. add simple refresh method 2015-01-21 00:11:59 -08:00
Isaac Gierard
a119033870 fixed some require paths also added isSupported include to index.js 2015-01-16 15:44:57 -08:00
Isaac Gierard
7e81f791a9 fixing issues with parse-options and related tests 2014-11-20 16:21:19 -08:00
Isaac Gierard
d4ba34e5ed moved options parsing into separate file and created test
moved the options paring system into it's own function so that it may be testable
2014-11-20 14:39:48 -08:00
Maxime Thirouin
3bc67f245c Cleanup & travis (should break) 2014-10-14 11:42:36 +02:00
Maxime Thirouin
165532d43c Relocate all the things 2014-10-14 08:23:56 +02:00