-
Notifications
You must be signed in to change notification settings - Fork 688
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
22 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.page=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
(function (process){ | ||
/* globals require, module */ | ||
|
||
'use strict'; | ||
|
@@ -201,8 +200,11 @@ | |
pageWindow.document.addEventListener(clickEvent, onclick, false); | ||
} | ||
hashbang = !!options.hashbang; | ||
if(hashbang && hasWindow && !hasHistory) { | ||
pageWindow.addEventListener('hashchange', onpopstate, false); | ||
} | ||
if (!dispatch) return; | ||
|
||
var url; | ||
if(isLocation) { | ||
var loc = pageWindow.location; | ||
|
@@ -232,6 +234,7 @@ | |
running = false; | ||
hasDocument && pageWindow.document.removeEventListener(clickEvent, onclick, false); | ||
hasWindow && pageWindow.removeEventListener('popstate', onpopstate, false); | ||
hasWindow && pageWindow.removeEventListener('hashchange', onpopstate, false); | ||
}; | ||
|
||
/** | ||
|
@@ -599,7 +602,9 @@ | |
/** | ||
* Handle "click" events. | ||
*/ | ||
|
||
/* jshint -W054 */ | ||
var hasProcess = new Function('return typeof process')() !== 'undefined'; | ||
/* jshint +W054 */ | ||
function onclick(e) { | ||
if (1 !== which(e)) return; | ||
|
||
|
@@ -626,7 +631,7 @@ | |
|
||
// ensure non-hash for the same path | ||
var link = el.getAttribute('href'); | ||
if (!hashbang && isLocation && el.pathname === location.pathname && (el.hash || '#' === link)) return; | ||
if(!hashbang && samePath(el) && (el.hash || '#' === link)) return; | ||
|
||
// Check for mailto: in the href | ||
if (link && link.indexOf('mailto:') > -1) return; | ||
|
@@ -648,7 +653,7 @@ | |
path = path[0] !== '/' ? '/' + path : path; | ||
|
||
// strip leading "/[drive letter]:" on NW.js on Windows | ||
if (typeof process !== 'undefined' && path.match(/^\/[a-zA-Z]:\//)) { | ||
if (hasProcess && path.match(/^\/[a-zA-Z]:\//)) { | ||
path = path.replace(/^\/[a-zA-Z]:\//, '/'); | ||
} | ||
|
||
|
@@ -704,20 +709,26 @@ | |
loc.port === url.port; | ||
} | ||
|
||
function samePath(url) { | ||
if(!isLocation) return false; | ||
var loc = pageWindow.location; | ||
return url.pathname === loc.pathname && | ||
url.search === loc.search; | ||
} | ||
|
||
/** | ||
* Gets the `base`, which depends on whether we are using History or | ||
* hashbang routing. | ||
*/ | ||
function getBase() { | ||
if(!!base) return base; | ||
var loc = hasWindow && pageWindow.location; | ||
return (hasWindow && hashbang && loc.protocol === 'file:') ? loc.pathname : base; | ||
var loc = pageWindow.location; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
matthewp
Author
Collaborator
|
||
return (hashbang && loc.protocol === 'file:') ? loc.pathname : base; | ||
} | ||
|
||
page.sameOrigin = sameOrigin; | ||
|
||
}).call(this,require('_process')) | ||
},{"_process":4,"path-to-regexp":3}],2:[function(require,module,exports){ | ||
},{"path-to-regexp":3}],2:[function(require,module,exports){ | ||
module.exports = Array.isArray || function (arr) { | ||
return Object.prototype.toString.call(arr) == '[object Array]'; | ||
}; | ||
|
@@ -1114,93 +1125,5 @@ function pathToRegexp (path, keys, options) { | |
return stringToRegexp(path, keys, options) | ||
} | ||
|
||
},{"isarray":2}],4:[function(require,module,exports){ | ||
// shim for using process in browser | ||
|
||
var process = module.exports = {}; | ||
|
||
process.nextTick = (function () { | ||
var canSetImmediate = typeof window !== 'undefined' | ||
&& window.setImmediate; | ||
var canMutationObserver = typeof window !== 'undefined' | ||
&& window.MutationObserver; | ||
var canPost = typeof window !== 'undefined' | ||
&& window.postMessage && window.addEventListener | ||
; | ||
|
||
if (canSetImmediate) { | ||
return function (f) { return window.setImmediate(f) }; | ||
} | ||
|
||
var queue = []; | ||
|
||
if (canMutationObserver) { | ||
var hiddenDiv = document.createElement("div"); | ||
var observer = new MutationObserver(function () { | ||
var queueList = queue.slice(); | ||
queue.length = 0; | ||
queueList.forEach(function (fn) { | ||
fn(); | ||
}); | ||
}); | ||
|
||
observer.observe(hiddenDiv, { attributes: true }); | ||
|
||
return function nextTick(fn) { | ||
if (!queue.length) { | ||
hiddenDiv.setAttribute('yes', 'no'); | ||
} | ||
queue.push(fn); | ||
}; | ||
} | ||
|
||
if (canPost) { | ||
window.addEventListener('message', function (ev) { | ||
var source = ev.source; | ||
if ((source === window || source === null) && ev.data === 'process-tick') { | ||
ev.stopPropagation(); | ||
if (queue.length > 0) { | ||
var fn = queue.shift(); | ||
fn(); | ||
} | ||
} | ||
}, true); | ||
|
||
return function nextTick(fn) { | ||
queue.push(fn); | ||
window.postMessage('process-tick', '*'); | ||
}; | ||
} | ||
|
||
return function nextTick(fn) { | ||
setTimeout(fn, 0); | ||
}; | ||
})(); | ||
|
||
process.title = 'browser'; | ||
process.browser = true; | ||
process.env = {}; | ||
process.argv = []; | ||
|
||
function noop() {} | ||
|
||
process.on = noop; | ||
process.addListener = noop; | ||
process.once = noop; | ||
process.off = noop; | ||
process.removeListener = noop; | ||
process.removeAllListeners = noop; | ||
process.emit = noop; | ||
|
||
process.binding = function (name) { | ||
throw new Error('process.binding is not supported'); | ||
}; | ||
|
||
// TODO(shtylman) | ||
process.cwd = function () { return '/' }; | ||
process.chdir = function (dir) { | ||
throw new Error('process.chdir is not supported'); | ||
}; | ||
|
||
},{}]},{},[1])(1) | ||
},{"isarray":2}]},{},[1])(1) | ||
}); |
It looks like the change from #455 got somehow overwritten by older code, this change has to be the other way around.