can-route-pushstate
Advanced tools
Comparing version 3.0.2 to 3.0.3
@@ -19,2 +19,3 @@ // # can/route/pushstate/pushstate.js | ||
var namespace = require('can-util/namespace'); | ||
var LOCATION = require('can-util/dom/location/location'); | ||
@@ -25,5 +26,5 @@ var canEvent = require('can-event'); | ||
var hasPushstate = window.history && window.history.pushState; | ||
var location = route.location || window.location; | ||
var loc = LOCATION(); | ||
var validProtocols = { 'http:': true, 'https:': true, '': true }; | ||
var usePushStateRouting = hasPushstate && location && validProtocols[location.protocol]; | ||
var usePushStateRouting = hasPushstate && loc && validProtocols[loc.protocol]; | ||
@@ -95,5 +96,7 @@ // Initialize plugin only if browser supports pushstate. | ||
var absolute = url.indexOf("http") === 0; | ||
var searchHash = window.location.search + window.location.hash; | ||
var loc = LOCATION(); | ||
var searchHash = loc.search + loc.hash; | ||
// If url differs from current call original histoy method and update `route` state. | ||
if ((!absolute && url !== window.location.pathname + searchHash) || (absolute && url !== window.location.href + searchHash)) { | ||
if ((!absolute && url !== loc.pathname + searchHash) || | ||
(absolute && url !== loc.href + searchHash)) { | ||
originalMethods[method].apply(window.history, arguments); | ||
@@ -127,2 +130,3 @@ route.setState(); | ||
var root = cleanRoot(), | ||
location = LOCATION(), | ||
loc = (location.pathname + location.search), | ||
@@ -129,0 +133,0 @@ index = loc.indexOf(root); |
{ | ||
"name": "can-route-pushstate", | ||
"version": "3.0.2", | ||
"version": "3.0.3", | ||
"description": "Pushstate for can-route", | ||
@@ -39,3 +39,3 @@ "homepage": "https://canjs.com", | ||
"can-route": "^3.0.0", | ||
"can-util": "^3.0.1" | ||
"can-util": "^3.3.0" | ||
}, | ||
@@ -42,0 +42,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40469
1008
Updatedcan-util@^3.3.0