Commit Graph
173 Commits
Author SHA1 Message Date
Behind The Math 2d4df39f72 Remove a redundant call to .blur() 2018-01-24 20:19:02 -05:00
Behind The Math fa05e94f07 Only blur element if it's contained by one of the selectors
Previously, Pjax would blur (remove focus) from the active element
regardless of where it was on the page. This restricts that to
happen only if the active element is contained by one of the
elements represented by options.selectors, because only those are
affected by Pjax.

Fixes #4
2018-01-24 20:18:41 -05:00
BehindTheMath e3df2b1c3d Merge pull request #114 from MoOx/fix/abort-pending-xhr
Abort previous pending XHR when navigating
2018-01-24 18:54:33 -05:00
Robin North 137322543c Explicitly flag if aborting a request fails due to request completing 2018-01-24 23:20:36 +00:00
Robin North f7f68b2e50 Fix module filename 2018-01-24 23:15:40 +00:00
Robin North ff62289683 Make use of new noop module 2018-01-24 14:51:16 +00:00
BehindTheMath 3205596f3e Merge pull request #115 from MoOx/feature/minify
Add a minified version of Pjax to NPM
2018-01-24 08:48:23 -05:00
Behind The Math 3c8cd087c5 Use double quotes in CLI arguments
Single quotes don't work in all environments.
2018-01-23 19:40:13 -05:00
Behind The Math 12f3be21fb Exclude pjax.min.js fom JSCS 2018-01-23 19:35:18 -05:00
Behind The Math b74fbc4178 Add a minified version of Pjax to NPM
Fixes #108.
2018-01-23 17:53:10 -05: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 feb85382f2 Revert back to using '**' glob for tests, wrap in quotes to force node to parse the args 2018-01-23 15:05:31 -05:00
Tim Trinidad f196604d73 Add tests to ensure options are not accidentally modified 2018-01-23 13:22:48 -05:00
Tim Trinidad 526a0883a2 Clone options in attach-link to prevent requestOptions changes from persisting 2018-01-23 13:22:31 -05:00
Robin North 486ef0e0ba Abort previous pending XHR when navigating 2018-01-23 15:25:56 +00:00
Behind The Math 6000ad5620 Restore the trigger for the resize and scroll events to onSwitch 2018-01-22 20:42:57 -05:00
BehindTheMath 9845244948 Merge pull request #111 from MoOx/fix/scroll
Enhance scrolling behavior

- Save scroll position with history
- Scroll to element position when URL contains a hash
- Add scrollRestoration option
2018-01-22 20:32:57 -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
Behind The Math 546b9abba3 Small bug fix 2018-01-22 17:32:59 -05:00
Behind The Math bc2432b18c Scroll to element position when URL contains a hash
When the URL contains a hash, try to find the corresponding
element, and if found, scroll to its position.

Based on darylteo/pjax@4893a2a657

Fixes #22.
2018-01-22 11:45:42 -05:00
Behind The Math 37d303ed66 Save scroll position with history
Save scroll position when navigating away from a page, and restore
it when navigating back to that page.

Fixes #30.
2018-01-22 11:27:13 -05:00
BehindTheMath b5c2120d08 Fix async switches (#110)
If any switches are async, the subsequent code will execute before the switches are finished. This PR moves all that code to a new function, and debounces the calls to onSwitch() so it only executes
once, after all the switches finish.

Fizes #72.
2018-01-22 10:55:29 -05:00
Robin North ca61c4a840 Fix incorrect main field in npm package (#105)
Point npm package `main` field at module source
2018-01-18 20:55:27 -05:00
Robin North cd09cc88d1 Replace instances of ES6 const keyword with var 2018-01-18 16:00:24 -05:00
Robin North b98e3ef914 Fix DOMException in switchElementsAlt()
Clone attribute nodes before setting on `oldEl` to prevent the following error:

```
DOMException: Failed to execute 'setNamedItem' on 'NamedNodeMap': The node provided is an attribute node that is already an attribute of another Element; attribute nodes must be explicitly cloned.
```
2018-01-17 17:07:02 -05:00
Behind The Math 36ed7079b1 Fix tooling for the example
Apparently we do need opn-cli.
2018-01-15 16:36:29 -05:00
BehindTheMath 6fa51e58f8 Add checks for XHR redirects (#101)
Fixes #7

This checks for redirects by looking for the following, in sequence:
- XMLHttpRequest.responseURL
- the X-PJAX-URL header (like jquery-pjax)
- the X-XHR-Redirected-To header (like Turbolinks)
2018-01-10 15:45:55 -05:00
Maxime Thirouin cb9c37fcb3 Use npmpub like it should since testling is gone 2018-01-09 16:02:09 -05:00
BehindTheMath 92d5e09494 Update tooling (#99)
- Update browserify, serve, and tape to the latest versions
- update the example script to reflect serve's new CLI options
- Remove the uneeded dependency on opn-cli
- Force Travis to use NPM 5.x
- Remove bower.json
2018-01-09 15:59:15 -05:00
Behind The Math 3bd101bb1d Update JSCS to the latest version 2018-01-09 14:09:40 -05:00
Behind The Math c0d64e41b8 Fix linting errors 2018-01-09 14:09:40 -05:00
Behind The Math e586440964 Update JSCS includes and excludes 2018-01-09 14:09:40 -05:00
BehindTheMath a2e6cfc0af Fix tests (#96)
Closes #63

- Switch from testling to jsdom for browser APIs
- Switch from coverify to nyc for coverage reports
- Clean up related dead code and tooling
- Update Travis to use Node v6 and v8, since we need ES6 features for jsdom.
2018-01-08 17:21:18 -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
BehindTheMath 0916c74171 Merge pull request #93 from BehindTheMath/bugfix/add-switchElementsAlt
Add switchElementsAlt() to the default switches

Fixes #83.
dev
2017-12-20 15:58:29 -05:00
Behind The Math 0781f820ee Add switchElementsAlt() to the default switches
Fixes #83.
2017-12-19 15:56:48 -05:00
Maxime Thirouin a7b584c469 Add direct download link
Ref #57
2017-12-19 14:11:55 +01:00
Oskar be5d58d550 Asynchronous switch functions (Make sure the DOM is parsed after switching) (#79)
* Make sure the DOM is parsed after switching

* Fix reload-link in the example
2017-12-19 13:58:22 +01:00
Bradley B Smith 1e40a0d70b Send the X-PJAX header with request (#80)
Make it more compatible with the jQuery PJAX and lets the server choose to optimize the response. Sending the list of selectors would be nice, too.
2017-12-19 13:56:30 +01:00
BehindTheMath 75eddfcab6 Add default switches to Pjax.switches (#92)
Fixes #68 and reverts #74
2017-12-19 13:49:26 +01:00
Maxime Thirouin 352e7114b6 Bye codesponsor 😢 2017-12-04 14:53:01 +01:00
markusfluer af57adaafb Fixed #77 Fails on Internet Explorer 2017-11-02 13:02:17 +01:00
markusfluer 09f14fc86c Added evaluation of remote script tags 2017-11-02 12:51:36 +01:00
markusfluer b17457f5a2 Fixed tests for request.js 2017-09-18 14:23:44 +02:00
markusfluer 86e5a2281a Added support do do a push-state ajax request with forms 2017-09-18 14:13:45 +02:00
Maxime Thirouin 109e78347f Update README.md 2017-09-14 21:45:39 +02:00
Markus Flür cb3b6b8a5d Merge pull request #81 from CPTechnikVX/patch-1
Fix bug on IE11 preventing from ajax page refresh
2017-07-20 15:34:50 +02:00
CPTechnikVX 6dffeba21a Fix bug on IE11 preventing from ajax page refresh
It used to be fixed a long time ago, but was perhaps merged away...
2016-11-28 15:39:14 +01:00