Skip to content

Commit 49548fd

Browse files
committed
Syntax tweaks
1 parent 1175d8b commit 49548fd

File tree

7 files changed

+20
-19
lines changed

7 files changed

+20
-19
lines changed

UPGRADE_GUIDE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,12 +232,12 @@ control of rendering.
232232

233233
```js
234234
// v0.10.x
235-
Router.renderRoutesToString(routes, path, function(html) {
235+
Router.renderRoutesToString(routes, path, function (html) {
236236
// do something with `html`
237237
});
238238

239239
// v0.11.x
240-
Router.run(routes, path, function(Handler) {
240+
Router.run(routes, path, function (Handler) {
241241
var html = React.renderToString(<Handler/>);
242242
});
243243
```

docs/guides/server-rendering.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ var routes = (
2020
// if using express it might look like this
2121
app.use(function (req, res) {
2222
// pass in `req.path` and the router will immediately match
23-
Router.run(routes, req.path, function(Handler) {
23+
Router.run(routes, req.path, function (Handler) {
2424
var content = React.renderToString(<Handler/>);
2525
res.render('main', {content: content});
2626
});

modules/components/__tests__/RouteHandler-test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ describe('RouteHandler', function () {
2525
}.bind(this);
2626
},
2727

28-
render: function() {
28+
render: function () {
2929
return (
3030
<div>
3131
<h1>Root</h1>
@@ -45,15 +45,15 @@ describe('RouteHandler', function () {
4545
var div = document.createElement('div');
4646
var steps = [];
4747

48-
steps.push(function(Handler, state) {
48+
steps.push(function (Handler, state) {
4949
React.render(<Handler/>, div, function () {
5050
expect(div.innerHTML).toMatch(/Foo/);
5151
TestLocation.push('/bar');
5252
});
5353
});
5454

55-
steps.push(function(Handler, state) {
56-
updateComponentBeforeNextRender(function() {
55+
steps.push(function (Handler, state) {
56+
updateComponentBeforeNextRender(function () {
5757
expect(div.innerHTML).toMatch(/Foo/);
5858
React.render(<Handler/>, div, function () {
5959
expect(div.innerHTML).toMatch(/Bar/);

modules/locations/HashLocation.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ var LocationActions = require('../actions/LocationActions');
44
var Path = require('../utils/Path');
55

66
/**
7-
* Returns the current URL path from the `hash` section of the URL, including query string
7+
* Returns the current URL path from the `hash` portion of the URL, including
8+
* query string.
89
*/
910
function getHashPath() {
1011
invariant(
@@ -13,8 +14,8 @@ function getHashPath() {
1314
);
1415

1516
return Path.decode(
16-
//cannot use window.location.hash because its not consistent
17-
//across browsers - Firefox will pre-decode it
17+
// We can't use window.location.hash here because it's not
18+
// consistent across browsers - Firefox will pre-decode it!
1819
window.location.href.split('#')[1] || ''
1920
);
2021
}

modules/locations/HistoryLocation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ var LocationActions = require('../actions/LocationActions');
44
var Path = require('../utils/Path');
55

66
/**
7-
* Returns the current URL path from `window.location`, including query string
7+
* Returns the current URL path from `window.location`, including query string.
88
*/
99
function getWindowPath() {
1010
invariant(

modules/locations/__tests__/HashLocation-test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
var expect = require('expect');
22
var HashLocation = require('../HashLocation');
33

4-
describe('HashLocation.getCurrentPath', function() {
4+
describe('HashLocation.getCurrentPath', function () {
55

66
//this test is needed because Firefox will pre-decode the value retrieved from
77
//window.location.hash
8-
it('returns a properly decoded equivalent of what window.location.hash is set to', function() {
8+
it('returns a properly decoded equivalent of what window.location.hash is set to', function () {
99
window.location.hash = '';
1010
expect(HashLocation.getCurrentPath()).toBe('');
1111

@@ -26,7 +26,7 @@ describe('HashLocation.getCurrentPath', function() {
2626

2727
//decodeURI doesn't handle lone percents
2828
window.location.hash = '%';
29-
expect(function() {
29+
expect(function () {
3030
HashLocation.getCurrentPath();
3131
}).toThrow(URIError);
3232

@@ -39,7 +39,7 @@ describe('HashLocation.getCurrentPath', function() {
3939
.toBe('complicated string/full%2Fof%3Fspecial%chars%20and%23escapesሴ');
4040
});
4141

42-
afterEach(function() {
42+
afterEach(function () {
4343
window.location.hash = '';
4444
});
4545
});

modules/utils/createRouter.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ function createRouter(options) {
354354
* Router.*Location objects (e.g. Router.HashLocation or Router.HistoryLocation).
355355
*/
356356
run: function (callback) {
357-
var dispatchHandler = function(error, transition) {
357+
var dispatchHandler = function (error, transition) {
358358
pendingTransition = null;
359359

360360
if (error) {
@@ -364,7 +364,7 @@ function createRouter(options) {
364364
} else {
365365
callback.call(router, router, nextState);
366366
}
367-
}
367+
};
368368

369369
if (typeof location === 'string') {
370370
warning(
@@ -383,9 +383,9 @@ function createRouter(options) {
383383
);
384384

385385
// Listen for changes to the location.
386-
var changeListener = function(change) {
386+
var changeListener = function (change) {
387387
router.dispatch(change.path, change.type, dispatchHandler);
388-
}
388+
};
389389

390390
if (location.addChangeListener)
391391
location.addChangeListener(changeListener);

0 commit comments

Comments
 (0)