Skip to content

Commit 6164fcb

Browse files
committed
Document differences in this fork; give own name to fork
1 parent c6e0050 commit 6164fcb

File tree

2 files changed

+36
-6
lines changed

2 files changed

+36
-6
lines changed

README.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,44 @@ allow the use of existing libraries.
88

99
Note: This library currently conforms to [XMLHttpRequest 1](http://www.w3.org/TR/XMLHttpRequest/). Version 2.0 will target [XMLHttpRequest Level 2](http://www.w3.org/TR/XMLHttpRequest2/).
1010

11+
## Difference from original node-XMLHttpRequest ##
12+
13+
When a protocol was missing from the [original node-XMLHttpRequest](https://github.com/driverdan/node-XMLHttpRequest/),
14+
`localhost` was intended to be assumed and any path determined relative to
15+
`localhost` root.
16+
17+
This fork avoids the need for having a server set up and running, and
18+
instead assumes a local file.
19+
20+
This project aims to ensure that the top-most requiring user-file is
21+
used for determining the base path (but not relative to unrelated
22+
higher executables like [nodeunit](https://github.com/caolan/nodeunit). More
23+
precisely speaking, the relativity of the path will be determined
24+
relative to the topmost file which meets either of the following
25+
criteria and is thus assumed to be the topmost user file:
26+
27+
1. No `node_modules` folder is present.
28+
1. The file's nearest "node_modules" ancestor contains our
29+
node-XMLHttpRequest code (i.e., the user file has XMLHttpRequest as a dependency)
30+
31+
This may not be perfect (and alternative ideas are welcome), but it
32+
is hoped it will allow the likes of `nodeunit` tests to be used with
33+
portable and easy to follow relative paths (not to mention with the
34+
possibility of reusing those same tests in the browser via the likes of
35+
[karma-nodeunit](https://github.com/karma-runner/karma-nodeunit)).
36+
1137
## Usage ##
1238

1339
Here's how to include the module in your project and use as the browser-based
1440
XHR object.
1541

42+
```js
1643
var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
1744
var xhr = new XMLHttpRequest();
45+
```
1846

1947
Note: use the lowercase string "xmlhttprequest" in your require(). On
20-
case-sensitive systems (eg Linux) using uppercase letters won't work.
48+
case-sensitive systems (e.g., Linux) using uppercase letters won't work.
2149

2250
## Versions ##
2351

package.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
{
2-
"name": "xmlhttprequest"
2+
"name": "local-xmlhttprequest"
33
, "description": "XMLHttpRequest for Node"
44
, "version": "1.5.1"
55
, "author": {
6-
"name": "Dan DeFelippi"
7-
, "url": "http://driverdan.com"
6+
"name": "Brett Zamir"
7+
, "email": "[email protected]"
8+
, "url": "http://brett-zamir.me)"
89
}
10+
, "contributors": ["Dan DeFelippi (http://driverdan.com)"]
911
, "keywords": ["xhr", "ajax"]
1012
, "licenses": [{
1113
"type": "MIT"
1214
, "url": "http://creativecommons.org/licenses/MIT/"
1315
}]
1416
, "repository": {
1517
"type": "git"
16-
, "url": "git://github.com/driverdan/node-XMLHttpRequest.git"
18+
, "url": "git://github.com/brettz9/node-XMLHttpRequest.git"
1719
}
18-
, "bugs": "http://github.com/driverdan/node-XMLHttpRequest/issues"
20+
, "bugs": "https://github.com/brettz9/node-XMLHttpRequest/issues"
1921
, "engines": {
2022
"node": ">=0.4.0"
2123
}

0 commit comments

Comments
 (0)