Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 1006c35999
Fetching contributors…

Cannot retrieve contributors at this time

executable file 95 lines (80 sloc) 2.893 kb
<!DOCTYPE html>
<title>Javelin History Test</title>
<link type="text/css" rel="stylesheet" href="">
<script type="text/javascript" src="../src/core/init.js"></script>
<script type="text/javascript" src="../src/core/util.js"></script>
<script type="text/javascript" src="../src/core/install.js"></script>
<h1>Page <span id="page">Initializing...</span></h1>
<div id="menu">
<a href="?page=1" data-sigil="async-page">Page 1</a>
<a href="?page=2" data-sigil="async-page">Page 2</a>
<a href="?page=3" data-sigil="async-page">Page 3</a>
<a><label><input id="replace" type="checkbox" />Replace</label></a>
<div style="clear: both;"></div>
<div id="core">
<h2 id="rand">Generating Random Number...</h2>
The randomly generated number will help you keep track of if/when a page
refresh ocurs.
The following path was last rendered. If you refresh the page, this path
should remain constant.
<pre> <span id="path">Initializing...</span></pre>
<h2>Safari Bug</h2>
This tests a known bug in Safari when using <tt>location.replace</tt> with
<tt>location.hash</tt>. This test should be run in Safari when installing
<tt>JX.History</tt> using <tt>JX.History.HASHCHANGE</tt>.
<button id="safari-bug-test">Clicking this button</button>
should go to Page 2. (The bug causes the button to go to Page 1.)
<!-- Source -->
<script type="text/javascript" src="../src/lib/DOM.js"></script>
<script type="text/javascript" src="../src/lib/URI.js"></script>
<script type="text/javascript" src="../src/core/Event.js"></script>
<script type="text/javascript" src="../src/core/Stratcom.js"></script>
<script type="text/javascript" src="../src/lib/History.js"></script>
<script type="text/javascript">
JX.Stratcom.mergeData(0, {});
JX.onload(function() {
JX.DOM.setContent(JX.$('rand'), Math.random());
function renderPage(href) {
JX.DOM.setContent(JX.$('page'), JX.$U(href).getQueryParams().page || 1);
JX.DOM.setContent(JX.$('path'), href);
JX.Stratcom.listen('click', 'async-page', function(e) {
var href = e.getNode('async-page').href;
JX.$('replace').checked ?
JX.History.replace(href) :
JX.Stratcom.listen('history:change', null, function(e) {
* Bug Tests
JX.DOM.listen(JX.$('safari-bug-test'), 'click', null, function() {
var uri = JX.$U(JX.History.getPath());
JX.History.push(uri.setQueryParam('page', 1).toString());
JX.History.replace(uri.setQueryParam('page', 2).toString());
JX.History.push(uri.setQueryParam('page', 3).toString());
Jump to Line
Something went wrong with that request. Please try again.