Socket
Socket
Sign inDemoInstall

browser-history-lite

Package Overview
Dependencies
0
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.0 to 0.1.1

.npmignore

75

index.js
/*
* @version 0.1.0
* @author Lauri Rooden <lauri@rooden.ee>
* @license MIT License
*/
/**
* @version 0.1.1
* @date 2014-09-16
* @stability 2 - Unstable
* @author Lauri Rooden <lauri@rooden.ee>
* @license MIT License
*/
!function(win, doc, his) {
// https://github.com/browserstate/history.js/wiki/The-State-of-the-HTML5-History-API
!function(window, document, history) {
var cb, base, last_route, iframe, tick, last
, loc = location
, clean_route = /^[#\/\!]+|[\s\/]+$/g
/*
* The JScript engine used in IE doesn't recognize vertical tabulation character
* http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
* oldIE = "\v" == "v"
*
* The documentMode is an IE only property, supported in IE8+.
*
* Starting in Internet Explorer 9 standards mode, Internet Explorer 10 standards mode,
* and win8_appname_long apps, you cannot identify the browser as Internet Explorer
* by testing for the equivalence of the vertical tab (\v) and the "v".
* In earlier versions, the expression "\v" === "v" returns true.
* In Internet Explorer 9 standards mode, Internet Explorer 10 standards mode,
* and win8_appname_long apps, the expression returns false.
*/
, ie6_7 = !+"\v1" && (doc.documentMode||1) < 8
// The JScript engine used in IE doesn't recognize vertical tabulation character
// http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
// oldIE = "\v" == "v"
//
// The documentMode is an IE only property, supported in IE8+.
//
// Starting in Internet Explorer 9 standards mode, Internet Explorer 10 standards mode,
// and win8_appname_long apps, you cannot identify the browser as Internet Explorer
// by testing for the equivalence of the vertical tab (\v) and the "v".
// In earlier versions, the expression "\v" === "v" returns true.
// In Internet Explorer 9 standards mode, Internet Explorer 10 standards mode,
// and win8_appname_long apps, the expression returns false.
, ie6_7 = !+"\v1" && (document.documentMode||1) < 8
function getUrl(_loc) {

@@ -41,3 +44,3 @@ var url

// bug in Safari where location.pathname is decoded
//
// var hash = loc.href.split('#')[1] || '';

@@ -60,7 +63,7 @@ // https://bugs.webkit.org/show_bug.cgi?id=30225

if (base) {
his[replace ? "replaceState" : "pushState"](null, null, base + url)
history[replace ? "replaceState" : "pushState"](null, null, base + url)
} else {
//*/
loc[replace ? "replace" : "assign"]("#" + url)
// Opening and closing the iframe tricks IE7 and earlier
// Opening and closing the iframe tricks IE7 and earlier
// to push a history entry on hash-tag change.

@@ -80,9 +83,9 @@ if (iframe && getUrl() !== getUrl(iframe.location) ) {

his.getUrl = getUrl
his.setUrl = setUrl
history.getUrl = getUrl
history.setUrl = setUrl
his.start = function(_cb, _base) {
history.start = function(_cb, _base) {
if (!cb) {
//** PUSH
if (_base && his.pushState) {
if (_base && history.pushState) {
base = _base

@@ -92,10 +95,10 @@ // Chrome and Safari emit a popstate event on page load, Firefox doesn't.

//
// See the discussion on https://bugs.webkit.org/show_bug.cgi?id=41372,
// See the discussion on https://bugs.webkit.org/show_bug.cgi?id=41372,
// https://code.google.com/p/chromium/issues/detail?id=63040
// and the change to the HTML5 spec that was made:
// http://html5.org/tools/web-apps-tracker?from=5345&to=5346.
win.onpopstate = checkUrl
// and the change to the HTML5 spec that was made:
// http://html5.org/tools/web-apps-tracker?from=5345&to=5346.
window.onpopstate = checkUrl
} else
//*/
if ("onhashchange" in win && !ie6_7) {
if ("onhashchange" in window && !ie6_7) {
// There are onhashchange in IE7 but its not get emitted

@@ -105,6 +108,8 @@ //

// Chrome 5.0, Firefox (Gecko) 3.6 (1.9.2), IE 8.0, Opera 10.6, Safari 5.0
win.onhashchange = checkUrl
window.onhashchange = checkUrl
} else {
if (ie6_7) {
iframe = doc.body.appendChild(doc.createElement('<iframe class="hide" src="javascript:0" tabindex="-1" />')).contentWindow
// IE<9 encounters the Mixed Content warning when the URI javascript: is used.
// IE5/6 additionally encounters the Mixed Content warning when the URI about:blank is used.
iframe = document.body.appendChild(document.createElement('<iframe class="hide" src="//:" tabindex="-1">')).contentWindow
}

@@ -111,0 +116,0 @@ last = getUrl()

{
"name": "browser-history-lite",
"version": "0.1.0",
"version": "0.1.1",
"stability": 2,

@@ -28,3 +28,3 @@ "license": "MIT",

"buildman": {
"build/hash-only.js": {
"dist/hash-only.js": {
"banner": "/*! litejs.com/MIT-LICENSE.txt */",

@@ -35,3 +35,3 @@ "devel": true,

},
"build/min.js": {
"dist/index-min.js": {
"banner": "/*! litejs.com/MIT-LICENSE.txt */",

@@ -38,0 +38,0 @@ "input": [

@version 0.1.0
@date 2014-05-16
@version 0.1.1
@date 2014-09-16
@stability 2 - Unstable

@@ -6,0 +6,0 @@

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc