history
Advanced tools
Comparing version 2.1.0 to 2.1.1
@@ -1,2 +0,2 @@ | ||
## [HEAD] | ||
## [v2.1.0] | ||
@@ -6,3 +6,3 @@ - Deprecate usage of `<base href>` as an automatic substitute for `basename` | ||
[HEAD]: https://github.com/mjackson/history/compare/latest...HEAD | ||
[v2.1.0]: https://github.com/mjackson/history/compare/v2.0.2...v2.1.0 | ||
[#94]: https://github.com/mjackson/history/issues/94 | ||
@@ -9,0 +9,0 @@ |
@@ -19,15 +19,28 @@ 'use strict'; | ||
// Automatically use the value of <base href> in HTML | ||
// documents as basename if it's not explicitly given. | ||
if (basename == null && canUseDOM) { | ||
var base = document.getElementsByTagName('base')[0]; | ||
var checkedBaseHref = false; | ||
if (base) { | ||
process.env.NODE_ENV !== 'production' ? warning(false, 'Automatically setting basename using <base href> is deprecated and will ' + 'be removed in the next major release. The semantics of <base href> are ' + 'subtly different from basename. Please pass the basename explicitly in ' + 'the options to createHistory') : undefined; | ||
function checkBaseHref() { | ||
if (checkedBaseHref) { | ||
return; | ||
} | ||
basename = base.getAttribute('href'); | ||
// Automatically use the value of <base href> in HTML | ||
// documents as basename if it's not explicitly given. | ||
if (basename == null && canUseDOM) { | ||
var base = document.getElementsByTagName('base')[0]; | ||
var baseHref = base && base.getAttribute('href'); | ||
if (baseHref != null) { | ||
basename = baseHref; | ||
process.env.NODE_ENV !== 'production' ? warning(false, 'Automatically setting basename using <base href> is deprecated and will ' + 'be removed in the next major release. The semantics of <base href> are ' + 'subtly different from basename. Please pass the basename explicitly in ' + 'the options to createHistory') : undefined; | ||
} | ||
} | ||
checkedBaseHref = true; | ||
} | ||
function addBasename(location) { | ||
checkBaseHref(); | ||
if (basename && location.basename == null) { | ||
@@ -48,2 +61,4 @@ if (location.pathname.indexOf(basename) === 0) { | ||
function prependBasename(location) { | ||
checkBaseHref(); | ||
if (!basename) return location; | ||
@@ -50,0 +65,0 @@ |
@@ -33,15 +33,28 @@ 'use strict'; | ||
// Automatically use the value of <base href> in HTML | ||
// documents as basename if it's not explicitly given. | ||
if (basename == null && _ExecutionEnvironment.canUseDOM) { | ||
var base = document.getElementsByTagName('base')[0]; | ||
var checkedBaseHref = false; | ||
if (base) { | ||
process.env.NODE_ENV !== 'production' ? _warning2['default'](false, 'Automatically setting basename using <base href> is deprecated and will ' + 'be removed in the next major release. The semantics of <base href> are ' + 'subtly different from basename. Please pass the basename explicitly in ' + 'the options to createHistory') : undefined; | ||
function checkBaseHref() { | ||
if (checkedBaseHref) { | ||
return; | ||
} | ||
basename = base.getAttribute('href'); | ||
// Automatically use the value of <base href> in HTML | ||
// documents as basename if it's not explicitly given. | ||
if (basename == null && _ExecutionEnvironment.canUseDOM) { | ||
var base = document.getElementsByTagName('base')[0]; | ||
var baseHref = base && base.getAttribute('href'); | ||
if (baseHref != null) { | ||
basename = baseHref; | ||
process.env.NODE_ENV !== 'production' ? _warning2['default'](false, 'Automatically setting basename using <base href> is deprecated and will ' + 'be removed in the next major release. The semantics of <base href> are ' + 'subtly different from basename. Please pass the basename explicitly in ' + 'the options to createHistory') : undefined; | ||
} | ||
} | ||
checkedBaseHref = true; | ||
} | ||
function addBasename(location) { | ||
checkBaseHref(); | ||
if (basename && location.basename == null) { | ||
@@ -62,2 +75,4 @@ if (location.pathname.indexOf(basename) === 0) { | ||
function prependBasename(location) { | ||
checkBaseHref(); | ||
if (!basename) return location; | ||
@@ -64,0 +79,0 @@ |
@@ -13,21 +13,34 @@ import warning from 'warning' | ||
// Automatically use the value of <base href> in HTML | ||
// documents as basename if it's not explicitly given. | ||
if (basename == null && canUseDOM) { | ||
const base = document.getElementsByTagName('base')[0] | ||
let checkedBaseHref = false | ||
if (base) { | ||
warning( | ||
false, | ||
'Automatically setting basename using <base href> is deprecated and will ' + | ||
'be removed in the next major release. The semantics of <base href> are ' + | ||
'subtly different from basename. Please pass the basename explicitly in ' + | ||
'the options to createHistory' | ||
) | ||
function checkBaseHref() { | ||
if (checkedBaseHref) { | ||
return | ||
} | ||
basename = base.getAttribute('href') | ||
// Automatically use the value of <base href> in HTML | ||
// documents as basename if it's not explicitly given. | ||
if (basename == null && canUseDOM) { | ||
const base = document.getElementsByTagName('base')[0] | ||
const baseHref = base && base.getAttribute('href') | ||
if (baseHref != null) { | ||
basename = baseHref | ||
warning( | ||
false, | ||
'Automatically setting basename using <base href> is deprecated and will ' + | ||
'be removed in the next major release. The semantics of <base href> are ' + | ||
'subtly different from basename. Please pass the basename explicitly in ' + | ||
'the options to createHistory' | ||
) | ||
} | ||
} | ||
checkedBaseHref = true | ||
} | ||
function addBasename(location) { | ||
checkBaseHref() | ||
if (basename && location.basename == null) { | ||
@@ -49,2 +62,4 @@ if (location.pathname.indexOf(basename) === 0) { | ||
function prependBasename(location) { | ||
checkBaseHref() | ||
if (!basename) | ||
@@ -51,0 +66,0 @@ return location |
{ | ||
"name": "history", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "Manage browser history with JavaScript", | ||
@@ -5,0 +5,0 @@ "files": [ |
249149
5606
52