Skip to content
Permalink
Browse files

lint-free

  • Loading branch information...
bevacqua committed Nov 26, 2014
1 parent 3aa4e61 commit 04130bcc6d6542ef4bca0da7dda37fa83ec0f502
@@ -17,6 +17,5 @@
"latedef": "nofunc",
"quotmark": "single",
"indent": 2,
"node": true,
"browser": true
"node": true
}
@@ -88,7 +88,7 @@ function start (data) {
emitter.emit('start', state.container, model, route);
global.DEBUG && global.DEBUG('[activator] started, executing client-side controller');
view(state.container, null, model, route, { render: false });
window.onpopstate = back;
global.onpopstate = back;
}

function back (e) {
@@ -12,7 +12,7 @@ function add (element, type, fn) {

function wrapperFactory (element, fn) {
return function wrapper (originalEvent) {
var e = originalEvent || window.event;
var e = originalEvent || global.event;
e.target = e.target || e.srcElement;
e.preventDefault = e.preventDefault || function preventDefault () { e.returnValue = false; };
e.stopPropagation = e.stopPropagation || function stopPropagation () { e.cancelBubble = true; };
@@ -1,14 +1,14 @@
'use strict';

var modern = 'history' in window && 'pushState' in history;
var api = modern && history;
var modern = 'history' in global && 'pushState' in global.history;
var api = modern && global.history;

// Google Chrome 38 on iOS makes weird changes to history.replaceState, breaking it
var nativeFn = require('../nativeFn');
var nativeReplaceBroken = !modern || !nativeFn(history.replaceState);
var nativeReplaceBroken = modern && !nativeFn(api.replaceState);
if (nativeReplaceBroken) {
api = {
pushState: history.pushState.bind(history)
pushState: api.pushState.bind(api)
};
}

@@ -5,6 +5,7 @@ var router = require('./router');
var events = require('./events');
var prefetcher = require('./prefetcher');
var activator = require('./activator');
var document = require('./global/document');
var origin = document.location.origin;
var leftClick = 1;
var prefetching = [];
@@ -8,6 +8,8 @@ var caching = require('./caching');
var componentCache = require('./componentCache');
var fetcher = require('./fetcher');
var versioning = require('../versioning');
var document = require('./global/document');
var location = require('./global/location');
var g = global;
var mounted;
var booted;
@@ -2,6 +2,7 @@

var url = require('fast-url-parser');
var routes = require('routes');
var location = require('./global/location');
var matcher = routes();
var protocol = /^[a-z]+?:\/\//i;

@@ -40,7 +40,7 @@ function test () {
function success () {
db = req.result;
try {
db.transaction('store', 'readwrite').objectStore('store').add(new Blob(), 'key');
db.transaction('store', 'readwrite').objectStore('store').add(new global.Blob(), 'key');
} catch (e) {
support(false);
} finally {
@@ -64,8 +64,8 @@ test('activator.start emits start', function (t) {
t.ok(history.replaceState.calledWith({ model: data.model }, data.model.title, route.url));
t.equal(state.route, route);
t.deepEqual(state.model, data.model);
t.equal(document.title, data.model.title);
t.equal(typeof window.onpopstate, 'function');
t.equal(global.document.title, data.model.title);
t.equal(typeof global.onpopstate, 'function');
t.end();
});

@@ -109,13 +109,13 @@ test('activator.start uses onpopstate successfully', function (t) {
// reset spies expected to fire in .start
view.reset();
history.replaceState.reset();
window.onpopstate();
global.onpopstate();
t.ok(view.notCalled);
window.onpopstate({});
global.onpopstate({});
t.ok(view.notCalled);
window.onpopstate({state:{}});
global.onpopstate({state:{}});
t.ok(view.notCalled);
window.onpopstate({state:{model:model}});
global.onpopstate({state:{model:model}});
t.ok(history.replaceState.calledWith({model: model}, model.title, route.url));
t.ok(view.calledWith(state.container, null, model, route));
t.ok(document.getElementById.calledWith('far'));
@@ -3,6 +3,7 @@
var test = require('tape');
var sinon = require('sinon');
var proxyquire = require('proxyquire');
var document = global.document;

test('links exposes an API', function (t) {
var links = require('../../browser/links');

0 comments on commit 04130bc

Please sign in to comment.
You can’t perform that action at this time.