Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

can-route-pushstate

Package Overview
Dependencies
Maintainers
15
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

can-route-pushstate - npm Package Compare versions

Comparing version 3.4.1 to 3.4.3

76

can-route-pushstate_test.js

@@ -908,2 +908,78 @@ /* jshint asi:true,scripturl:true */

test("javascript: void(0) links get pushstated", function(){
stop();
makeTestingIframe(function (info, done) {
info.route(":type", { type: "yay" });
info.route.ready();
var window = info.window;
var link = window.document.createElement("a");
link.href = "javascript: void(0)";
link.innerHTML = "Click Me";
window.document.body.appendChild(link);
try {
domDispatch.call(link, "click");
ok(true, "Clicking javascript: void(0) anchor did not cause a security exception");
} catch(err) {
ok(false, "Clicking javascript: void(0) anchor caused a security exception");
}
start();
done();
});
});
test("links with target=_blank do not get pushstated", function(){
stop();
makeTestingIframe(function (info, done) {
info.route(":type", { type: "yay" });
info.route.ready();
var window = info.window;
var link = window.document.createElement("a");
link.href = "/yay";
link.target = "_blank";
link.innerHTML = "Click Me";
window.document.body.appendChild(link);
try {
domDispatch.call(link, "click");
ok(true, "Clicking anchor with blank target did not cause a security exception");
} catch(err) {
ok(false, "Clicking anchor with blank target caused a security exception");
}
start();
done();
});
});
test("clicking on links while holding meta key do not get pushstated", function(){
stop();
makeTestingIframe(function (info, done) {
info.route(":type", { type: "yay" });
info.route.ready();
var window = info.window;
var link = window.document.createElement("a");
link.href = "/heyo";
link.innerHTML = "Click Me";
window.document.body.appendChild(link);
try {
domDispatch.call(link, {type: 'click', metaKey: true});
ok(true, "Clicking anchor with blank target did not cause a security exception");
} catch(err) {
ok(false, "Clicking anchor with blank target caused a security exception");
}
start();
done();
});
});
} // end steal-only

@@ -910,0 +986,0 @@

@@ -180,2 +180,12 @@ // # can/route/pushstate/pushstate.js

// Do not pushstate if target is for blank window.
if (node.target === "_blank") {
return;
}
// Do not pushstate if meta key was pressed, mimicking standard browser behavior.
if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) {
return;
}
// If link is within the same domain and descendant of `root`

@@ -182,0 +192,0 @@ if (window.location.host === linksHost) {

8

dist/amd/can-route-pushstate.js

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

/*can-route-pushstate@3.4.0#can-route-pushstate*/
/*can-route-pushstate@3.4.2#can-route-pushstate*/
define([

@@ -105,2 +105,8 @@ 'require',

}
if (node.target === '_blank') {
return;
}
if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) {
return;
}
if (window.location.host === linksHost) {

@@ -107,0 +113,0 @@ var root = cleanRoot();

2

package.json
{
"name": "can-route-pushstate",
"version": "3.4.1",
"version": "3.4.3",
"description": "Pushstate for can-route",

@@ -5,0 +5,0 @@ "homepage": "https://canjs.com",

Sorry, the diff of this file is too big to display

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