Socket
Socket
Sign inDemoInstall

swup

Package Overview
Dependencies
Maintainers
1
Versions
142
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

swup - npm Package Compare versions

Comparing version 0.3.9 to 0.3.10

17

lib/index.js

@@ -128,2 +128,9 @@ 'use strict';

skipPopStateHandling: function skipPopStateHandling(event) {
if (event.state && event.state.source == "swup") {
return false;
}
return true;
},
LINK_SELECTOR: 'a[href^="/"]:not([data-no-swup]), a[href^="#"]:not([data-no-swup]), a[xlink\\:href]'

@@ -268,2 +275,11 @@

/**
* modify initial history record
*/
window.history.replaceState(Object.assign({}, window.history.state, {
url: window.location.href,
random: Math.random(),
source: "swup"
}), document.title, window.location.href);
/**
* trigger enabled event

@@ -385,2 +401,3 @@ */

var link = new _Link2.default();
if (this.options.skipPopStateHandling(event)) return;
link.setPath(event.state ? event.state.url : window.location.pathname);

@@ -387,0 +404,0 @@ if (link.getHash() != '') {

5

lib/modules/createState.js

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,4 +6,5 @@ module.exports = function (url) {

url: url || window.location.href.split(window.location.hostname)[1],
random: Math.random()
random: Math.random(),
source: "swup"
}, document.getElementsByTagName('title')[0].innerText, url || window.location.href.split(window.location.hostname)[1]);
};

2

package.json
{
"name": "swup",
"version": "0.3.9",
"version": "0.3.10",
"description": "Animated page transitions with css.",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -268,2 +268,17 @@ # swup

### Skip popState Handling
Swup is built around browser history API, but sometimes some other tools manipulating the browser history can be used as well.
For this reason, swup places a source property into every history state object it creates, so it can be later identified (swup also modifies current history record on start, to include the "swup" source property as well).
On `popState` events, swup only handles the records that were created by swup.
This behavior can be modified by `skipPopStateHandling` option, which is represented by a function returning boolean (false = handle the popstate, true = do nothing).
The function accepts one argument - the popstate event. Option defaults to the following:
```javascript
skipPopStateHandling: function(event){
if (event.state && event.state.source == "swup") {
return false;
}
return true;
}
```
### Default values

@@ -283,3 +298,9 @@ ```javascript

support: true,
disableIE: false
disableIE: false,
skipPopStateHandling: function(event){
if (event.state && event.state.source == "swup") {
return false;
}
return true;
},
}

@@ -286,0 +307,0 @@ ```

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc