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.
`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
* 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
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
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.
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.
```
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)
Events triggered on top level elements (such as window or document)
lead to a HierarchyRequestError due to a fix in IE browsers
where dispatchEvent does not fire if an element is not in the DOM.
The current test is simply to check for the existence of parentNode
However, this means top level elements get added to itself, causing
the error.
The proposed fix simply tests for top level elements in the test.
also added test for uniqueid. only test that two calls to uniqueid return unique enties. had to modify the output slightly and added a counter to the system otherwise two back to back calls would return the same value.