README: Update release instructions & formatting

The previous jsdom API is no longer supported in its latest version. README
was updated.

Fixes jquery/jquery#4546
Closes gh-5
parent 15bc7380
...@@ -32,7 +32,7 @@ import $ from "jquery"; ...@@ -32,7 +32,7 @@ import $ from "jquery";
There are several ways to use [Browserify](http://browserify.org/) and [Webpack](https://webpack.github.io/). For more information on using these tools, please refer to the corresponding project's documention. In the script, including jQuery will usually look like this... There are several ways to use [Browserify](http://browserify.org/) and [Webpack](https://webpack.github.io/). For more information on using these tools, please refer to the corresponding project's documention. In the script, including jQuery will usually look like this...
```js ```js
var $ = require("jquery"); var $ = require( "jquery" );
``` ```
#### AMD (Asynchronous Module Definition) #### AMD (Asynchronous Module Definition)
...@@ -40,9 +40,9 @@ var $ = require("jquery"); ...@@ -40,9 +40,9 @@ var $ = require("jquery");
AMD is a module format built for the browser. For more information, we recommend [require.js' documentation](http://requirejs.org/docs/whyamd.html). AMD is a module format built for the browser. For more information, we recommend [require.js' documentation](http://requirejs.org/docs/whyamd.html).
```js ```js
define(["jquery"], function($) { define( [ "jquery" ], function( $ ) {
}); } );
``` ```
### Node ### Node
...@@ -56,12 +56,7 @@ npm install jquery ...@@ -56,12 +56,7 @@ npm install jquery
For jQuery to work in Node, a window with a document is required. Since no such window exists natively in Node, one can be mocked by tools such as [jsdom](https://github.com/tmpvar/jsdom). This can be useful for testing purposes. For jQuery to work in Node, a window with a document is required. Since no such window exists natively in Node, one can be mocked by tools such as [jsdom](https://github.com/tmpvar/jsdom). This can be useful for testing purposes.
```js ```js
require("jsdom").env("", function(err, window) { const { JSDOM } = require( "jsdom" );
if (err) { const { window } = new JSDOM( "" );
console.error(err); const $ = require( "jquery" )( window );
return;
}
var $ = require("jquery")(window);
});
``` ```
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment