Markdown PHP 1.3 | the original parser

jQuery - New Wave JavaScript

Contribution Guides

In the spirit of open source software development, jQuery always encourages community code contribution. To help you get started and before you jump into writing code, be sure to read these important contribution guidelines thoroughly:

  1. Getting Involved
  2. Core Style Guide
  3. Tips For Bug Patching

What you need to build your own jQuery

In order to build jQuery, you need to have Node.js/npm latest and git 1.7 or later. (Earlier versions might work OK, but are not tested.)

For Windows you have to download and install git and Node.js.

Mac OS users should install Homebrew. Once Homebrew is installed, run brew install git to install git, and brew install node to install Node.js.

Linux/BSD users should use their appropriate package managers to install git and Node.js, or build from source if you swing that way. Easy-peasy.

How to build your own jQuery

Clone a copy of the main jQuery git repo by running:

bash git clone git://github.com/jquery/jquery.git

Enter the jquery directory and run the build script: bash cd jquery && npm run-script build The built version of jQuery will be put in the dist/ subdirectory, along with the minified copy and associated map file.

If you want create custom build or help with jQuery development, it would be better to install grunt command line interface as a global package:

npm install -g grunt-cli Make sure you have grunt installed by testing: grunt -v

Now by running grunt command, in the jquery directory, you could build full version of jQuery, just like with npm run-script build command: grunt

There are many other tasks avaliable for jQuery Core: grunt -help

Modules

Special builds can be created that exclude subsets of jQuery functionality. This allows for smaller custom builds when the builder is certain that those parts of jQuery are not being used. For example, an app that only used JSONP for $.ajax() and did not need to calculate offsets or positions of elements could exclude the offset and ajax/xhr modules.

Any module may be excluded except for core, and selector. To exclude a module, pass its path relative to the src folder (without the .js extension).

Some example modules that can be excluded are:

As a special case, you may also replace Sizzle by using a special flag grunt custom:-sizzle.

Note: Excluding Sizzle will also exclude all jQuery selector extensions (such as effects/animatedSelector and css/hiddenVisibleSelectors).

The build process shows a message for each dependent module it excludes or includes.

To create a custom build of the latest stable version, first check out the version:

bash git pull; git checkout $(git describe --abbrev=0 --tags)

Then, make sure all Node dependencies are installed:

bash npm install

Create the custom build, use the grunt custom option, listing the modules to be excluded. Examples:

Exclude all ajax functionality:

bash grunt custom:-ajax

Excluding css removes modules depending on CSS: effects, offset, dimensions.

bash grunt custom:-css

Exclude a bunch of modules:

bash grunt custom:-ajax,-css,-deprecated,-dimensions,-effects,-event/alias,-offset,-wrap

For questions or requests regarding custom builds, please start a thread on the Developing jQuery Core section of the forum. Due to the combinatorics and custom nature of these builds, they are not regularly tested in jQuery's unit test process. The non-Sizzle selector engine currently does not pass unit tests because it is missing too much essential functionality.

Running the Unit Tests

Make sure you have the necessary dependencies:

bash npm install

Start grunt watch or npm start to auto-build jQuery as you work:

bash cd jquery && grunt watch

Run the unit tests with a local server that supports PHP. Ensure that you run the site from the root directory, not the "test" directory. No database is required. Pre-configured php local servers are available for Windows and Mac. Here are some options:

Building to a different directory

To copy the built jQuery files from /dist to another directory:

bash grunt && grunt dist:/path/to/special/location/ With this example, the output files would be:

bash /path/to/special/location/jquery.js /path/to/special/location/jquery.min.js

To add a permanent copy destination, create a file in dist/ called ".destination.json". Inside the file, paste and customize the following:

```json

{ "/Absolute/path/to/other/destination": true } ```

Additionally, both methods can be combined.

Essential Git

As the source code is handled by the version control system Git, it's useful to know some features used.

cleaning

If you want to purge your working directory back to the status of upstream, following commands can be used (remember everything you've worked on is gone after these):

bash git reset --hard upstream/master git clean -fdx

rebasing

For feature/topic branches, you should always use the --rebase flag to git pull, or if you are usually handling many temporary "to be in a github pull request" branches, run following to automate this:

bash git config branch.autosetuprebase local (see man git-config for more information)

handling merge conflicts

If you're getting merge conflicts when merging, instead of editing the conflicted files manually, you can use the feature git mergetool. Even though the default tool xxdiff looks awful/old, it's rather useful.

Following are some commands that can be used there:

QUnit Reference

Test methods

js expect( numAssertions ); stop(); start();

note: QUnit's eventual addition of an argument to stop/start is ignored in this test suite so that start and stop can be passed as callbacks without worrying about their parameters

Test assertions

js ok( value, [message] ); equal( actual, expected, [message] ); notEqual( actual, expected, [message] ); deepEqual( actual, expected, [message] ); notDeepEqual( actual, expected, [message] ); strictEqual( actual, expected, [message] ); notStrictEqual( actual, expected, [message] ); raises( block, [expected], [message] );

Test Suite Convenience Methods Reference (See test/data/testinit.js)

Returns an array of elements with the given IDs

js q( ... );

Example:

```js q("main", "foo", "bar");

=> [ div#main, span#foo, input#bar ] ```

Asserts that a selection matches the given IDs

js t( testName, selector, [ "array", "of", "ids" ] );

Example:

js t("Check for something", "//[a]", ["foo", "baar"]);

Fires a native DOM event without going through jQuery

js fireNative( node, eventType )

Example:

js fireNative( jQuery("#elem")[0], "click" );

Add random number to url to stop caching

js url( "some/url.php" );

Example:

```js url("data/test.html");

=> "data/test.html?10538358428943"

url("data/test.php?foo=bar");

=> "data/test.php?foo=bar&10538358345554" ```

Load tests in an iframe

Loads a given page constructing a url with fileName: "./data/" + fileName + ".html" and fires the given callback on jQuery ready (using the jQuery loading from that page) and passes the iFrame's jQuery to the callback.

js testIframe( fileName, testName, callback );

Callback arguments:

js callback( jQueryFromIFrame, iFrameWindow, iFrameDocument );

Load tests in an iframe (window.iframeCallback)

Loads a given page constructing a url with fileName: "./data/" + fileName + ".html" The given callback is fired when window.iframeCallback is called by the page The arguments passed to the callback are the same as the arguments passed to window.iframeCallback, whatever that may be

js testIframeWithCallback( testName, fileName, callback );

Questions?

If you have any questions, please feel free to ask on the Developing jQuery Core forum or in #jquery on irc.freenode.net.

Parsed in 5.52 ms
<h1><a href="http://jquery.com/">jQuery</a> - New Wave JavaScript</h1>

<h2>Contribution Guides</h2>

<p>In the spirit of open source software development, jQuery always encourages community code contribution. To help you get started and before you jump into writing code, be sure to read these important contribution guidelines thoroughly:</p>

<ol>
<li><a href="http://docs.jquery.com/Getting_Involved">Getting Involved</a></li>
<li><a href="http://docs.jquery.com/JQuery_Core_Style_Guidelines">Core Style Guide</a></li>
<li><a href="http://docs.jquery.com/Tips_for_jQuery_Bug_Patching">Tips For Bug Patching</a></li>
</ol>

<h2>What you need to build your own jQuery</h2>

<p>In order to build jQuery, you need to have Node.js/npm latest and git 1.7 or later.
(Earlier versions might work OK, but are not tested.)</p>

<p>For Windows you have to download and install <a href="http://git-scm.com/downloads">git</a> and <a href="http://nodejs.org/download/">Node.js</a>.</p>

<p>Mac OS users should install <a href="http://mxcl.github.com/homebrew/">Homebrew</a>. Once Homebrew is installed, run <code>brew install git</code> to install git,
and <code>brew install node</code> to install Node.js.</p>

<p>Linux/BSD users should use their appropriate package managers to install git and Node.js, or build from source
if you swing that way. Easy-peasy.</p>

<h2>How to build your own jQuery</h2>

<p>Clone a copy of the main jQuery git repo by running:</p>

<p><code>bash
git clone git://github.com/jquery/jquery.git</code></p>

<p>Enter the jquery directory and run the build script:
<code>bash
cd jquery &amp;&amp; npm run-script build</code>
The built version of jQuery will be put in the <code>dist/</code> subdirectory, along with the minified copy and associated map file.</p>

<p>If you want create custom build or help with jQuery development, it would be better to install <a href="https://github.com/gruntjs/grunt-cli">grunt command line interface</a> as a global package:</p>

<p><code>npm install -g grunt-cli</code>
Make sure you have <code>grunt</code> installed by testing:
<code>grunt -v</code></p>

<p>Now by running <code>grunt</code> command, in the jquery directory, you could build full version of jQuery, just like with <code>npm run-script build</code> command:
<code>grunt</code></p>

<p>There are many other tasks avaliable for jQuery Core:
<code>grunt -help</code></p>

<h3>Modules</h3>

<p>Special builds can be created that exclude subsets of jQuery functionality.
This allows for smaller custom builds when the builder is certain that those parts of jQuery are not being used.
For example, an app that only used JSONP for <code>$.ajax()</code> and did not need to calculate offsets or positions of elements could exclude the offset and ajax/xhr modules.</p>

<p>Any module may be excluded except for <code>core</code>, and <code>selector</code>. To exclude a module, pass its path relative to the <code>src</code> folder (without the <code>.js</code> extension).</p>

<p>Some example modules that can be excluded are:</p>

<ul>
<li><strong>ajax</strong>: All AJAX functionality: <code>$.ajax()</code>, <code>$.get()</code>, <code>$.post()</code>, <code>$.ajaxSetup()</code>, <code>.load()</code>, transports, and ajax event shorthands such as <code>.ajaxStart()</code>.</li>
<li><strong>ajax/xhr</strong>: The XMLHTTPRequest AJAX transport only.</li>
<li><strong>ajax/script</strong>: The <code>&lt;script&gt;</code> AJAX transport only; used to retrieve scripts.</li>
<li><strong>ajax/jsonp</strong>: The JSONP AJAX transport only; depends on the ajax/script transport.</li>
<li><strong>css</strong>: The <code>.css()</code> method plus non-animated <code>.show()</code>, <code>.hide()</code> and <code>.toggle()</code>. Also removes <strong>all</strong> modules depending on css (including <strong>effects</strong>, <strong>dimensions</strong>, and <strong>offset</strong>).</li>
<li><strong>deprecated</strong>: Methods documented as deprecated but not yet removed; currently only <code>.andSelf()</code>.</li>
<li><strong>dimensions</strong>: The <code>.width()</code> and <code>.height()</code> methods, including <code>inner-</code> and <code>outer-</code> variations.</li>
<li><strong>effects</strong>: The <code>.animate()</code> method and its shorthands such as <code>.slideUp()</code> or <code>.hide("slow")</code>.</li>
<li><strong>event</strong>: The <code>.on()</code> and <code>.off()</code> methods and all event functionality. Also removes <code>event/alias</code>.</li>
<li><strong>event/alias</strong>: All event attaching/triggering shorthands like <code>.click()</code> or <code>.mouseover()</code>.</li>
<li><strong>offset</strong>: The <code>.offset()</code>, <code>.position()</code>, <code>.offsetParent()</code>, <code>.scrollLeft()</code>, and <code>.scrollTop()</code> methods.</li>
<li><strong>wrap</strong>: The <code>.wrap()</code>, <code>.wrapAll()</code>, <code>.wrapInner()</code>, and <code>.unwrap()</code> methods.</li>
<li><strong>exports/amd</strong>: Exclude the AMD definition.</li>
<li><strong>core/ready</strong>: Exclude the ready module if you place your scripts at the end of the body. Any ready callbacks bound with <code>jQuery()</code> will simply be called immediately. However, <code>jQuery(document).ready()</code> will not be a function and <code>.on("ready", ...)</code> or similar will not be triggered.</li>
<li><strong>deferred</strong>: Exclude jQuery.Deferred. This also removes jQuery.Callbacks. <em>Note</em> that modules that depend on jQuery.Deferred(AJAX, effects, core/ready) will not be removed and will still expect jQuery.Deferred to be there. Include your own jQuery.Deferred implementation or exclude those modules as well (<code>grunt custom:-deferred,-ajax,-effects,-core/ready</code>).</li>
</ul>

<p>As a special case, you may also replace Sizzle by using a special flag <code>grunt custom:-sizzle</code>.</p>

<ul>
<li><strong>sizzle</strong>: The Sizzle selector engine. When this module is excluded, it is replaced by a rudimentary selector engine based on the browser's <code>querySelectorAll</code> method that does not support jQuery selector extensions or enhanced semantics. See the selector-native.js file for details.</li>
</ul>

<p><em>Note</em>: Excluding Sizzle will also exclude all jQuery selector extensions (such as <code>effects/animatedSelector</code> and <code>css/hiddenVisibleSelectors</code>).</p>

<p>The build process shows a message for each dependent module it excludes or includes.</p>

<p>To create a custom build of the latest stable version, first check out the version:</p>

<p><code>bash
git pull; git checkout $(git describe --abbrev=0 --tags)</code></p>

<p>Then, make sure all Node dependencies are installed:</p>

<p><code>bash
npm install</code></p>

<p>Create the custom build, use the <code>grunt custom</code> option, listing the modules to be excluded. Examples:</p>

<p>Exclude all <strong>ajax</strong> functionality:</p>

<p><code>bash
grunt custom:-ajax</code></p>

<p>Excluding <strong>css</strong> removes modules depending on CSS: <strong>effects</strong>, <strong>offset</strong>, <strong>dimensions</strong>.</p>

<p><code>bash
grunt custom:-css</code></p>

<p>Exclude a bunch of modules:</p>

<p><code>bash
grunt custom:-ajax,-css,-deprecated,-dimensions,-effects,-event/alias,-offset,-wrap</code></p>

<p>For questions or requests regarding custom builds, please start a thread on the <a href="https://forum.jquery.com/developing-jquery-core">Developing jQuery Core</a> section of the forum. Due to the combinatorics and custom nature of these builds, they are not regularly tested in jQuery's unit test process. The non-Sizzle selector engine currently does not pass unit tests because it is missing too much essential functionality.</p>

<h2>Running the Unit Tests</h2>

<p>Make sure you have the necessary dependencies:</p>

<p><code>bash
npm install</code></p>

<p>Start <code>grunt watch</code> or <code>npm start</code> to auto-build jQuery as you work:</p>

<p><code>bash
cd jquery &amp;&amp; grunt watch</code></p>

<p>Run the unit tests with a local server that supports PHP. Ensure that you run the site from the root directory, not the "test" directory. No database is required. Pre-configured php local servers are available for Windows and Mac. Here are some options:</p>

<ul>
<li>Windows: <a href="http://www.wampserver.com/en/">WAMP download</a></li>
<li>Mac: <a href="http://www.mamp.info/en/index.html">MAMP download</a></li>
<li>Linux: <a href="https://www.linux.com/learn/tutorials/288158-easy-lamp-server-installation">Setting up LAMP</a></li>
<li><a href="http://code.google.com/p/mongoose/">Mongoose (most platforms)</a></li>
</ul>

<h2>Building to a different directory</h2>

<p>To copy the built jQuery files from <code>/dist</code> to another directory:</p>

<p><code>bash
grunt &amp;&amp; grunt dist:/path/to/special/location/</code>
With this example, the output files would be:</p>

<p><code>bash
/path/to/special/location/jquery.js
/path/to/special/location/jquery.min.js</code></p>

<p>To add a permanent copy destination, create a file in <code>dist/</code> called ".destination.json". Inside the file, paste and customize the following:</p>

<p>```json</p>

<p>{
  "/Absolute/path/to/other/destination": true
}
```</p>

<p>Additionally, both methods can be combined.</p>

<h2>Essential Git</h2>

<p>As the source code is handled by the version control system Git, it's useful to know some features used.</p>

<h3>cleaning</h3>

<p>If you want to purge your working directory back to the status of upstream, following commands can be used (remember everything you've worked on is gone after these):</p>

<p><code>bash
git reset --hard upstream/master
git clean -fdx</code></p>

<h3>rebasing</h3>

<p>For feature/topic branches, you should always use the <code>--rebase</code> flag to <code>git pull</code>, or if you are usually handling many temporary "to be in a github pull request" branches, run following to automate this:</p>

<p><code>bash
git config branch.autosetuprebase local</code>
(see <code>man git-config</code> for more information)</p>

<h3>handling merge conflicts</h3>

<p>If you're getting merge conflicts when merging, instead of editing the conflicted files manually, you can use the feature
<code>git mergetool</code>. Even though the default tool <code>xxdiff</code> looks awful/old, it's rather useful.</p>

<p>Following are some commands that can be used there:</p>

<ul>
<li><code>Ctrl + Alt + M</code> - automerge as much as possible</li>
<li><code>b</code> - jump to next merge conflict</li>
<li><code>s</code> - change the order of the conflicted lines</li>
<li><code>u</code> - undo a merge</li>
<li><code>left mouse button</code> - mark a block to be the winner</li>
<li><code>middle mouse button</code> - mark a line to be the winner</li>
<li><code>Ctrl + S</code> - save</li>
<li><code>Ctrl + Q</code> - quit</li>
</ul>

<h2><a href="http://docs.jquery.com/QUnit">QUnit</a> Reference</h2>

<h3>Test methods</h3>

<p><code>js
expect( numAssertions );
stop();
start();</code></p>

<p>note: QUnit's eventual addition of an argument to stop/start is ignored in this test suite so that start and stop can be passed as callbacks without worrying about their parameters</p>

<h3>Test assertions</h3>

<p><code>js
ok( value, [message] );
equal( actual, expected, [message] );
notEqual( actual, expected, [message] );
deepEqual( actual, expected, [message] );
notDeepEqual( actual, expected, [message] );
strictEqual( actual, expected, [message] );
notStrictEqual( actual, expected, [message] );
raises( block, [expected], [message] );</code></p>

<h2>Test Suite Convenience Methods Reference (See <a href="https://github.com/jquery/jquery/blob/master/test/data/testinit.js">test/data/testinit.js</a>)</h2>

<h3>Returns an array of elements with the given IDs</h3>

<p><code>js
q( ... );</code></p>

<p>Example:</p>

<p>```js
q("main", "foo", "bar");</p>

<p>=> [ div#main, span#foo, input#bar ]
```</p>

<h3>Asserts that a selection matches the given IDs</h3>

<p><code>js
t( testName, selector, [ "array", "of", "ids" ] );</code></p>

<p>Example:</p>

<p><code>js
t("Check for something", "//[a]", ["foo", "baar"]);</code></p>

<h3>Fires a native DOM event without going through jQuery</h3>

<p><code>js
fireNative( node, eventType )</code></p>

<p>Example:</p>

<p><code>js
fireNative( jQuery("#elem")[0], "click" );</code></p>

<h3>Add random number to url to stop caching</h3>

<p><code>js
url( "some/url.php" );</code></p>

<p>Example:</p>

<p>```js
url("data/test.html");</p>

<p>=> "data/test.html?10538358428943"</p>

<p>url("data/test.php?foo=bar");</p>

<p>=> "data/test.php?foo=bar&amp;10538358345554"
```</p>

<h3>Load tests in an iframe</h3>

<p>Loads a given page constructing a url with fileName: <code>"./data/" + fileName + ".html"</code>
and fires the given callback on jQuery ready (using the jQuery loading from that page)
and passes the iFrame's jQuery to the callback.</p>

<p><code>js
testIframe( fileName, testName, callback );</code></p>

<p>Callback arguments:</p>

<p><code>js
callback( jQueryFromIFrame, iFrameWindow, iFrameDocument );</code></p>

<h3>Load tests in an iframe (window.iframeCallback)</h3>

<p>Loads a given page constructing a url with fileName: <code>"./data/" + fileName + ".html"</code>
The given callback is fired when window.iframeCallback is called by the page
The arguments passed to the callback are the same as the
arguments passed to window.iframeCallback, whatever that may be</p>

<p><code>js
testIframeWithCallback( testName, fileName, callback );</code></p>

<h2>Questions?</h2>

<p>If you have any questions, please feel free to ask on the
<a href="http://forum.jquery.com/developing-jquery-core">Developing jQuery Core forum</a> or in #jquery on irc.freenode.net.</p>
Parsedown | the parser that we created

jQuery - New Wave JavaScript

Contribution Guides

In the spirit of open source software development, jQuery always encourages community code contribution. To help you get started and before you jump into writing code, be sure to read these important contribution guidelines thoroughly:

  1. Getting Involved
  2. Core Style Guide
  3. Tips For Bug Patching

What you need to build your own jQuery

In order to build jQuery, you need to have Node.js/npm latest and git 1.7 or later. (Earlier versions might work OK, but are not tested.)

For Windows you have to download and install git and Node.js.

Mac OS users should install Homebrew. Once Homebrew is installed, run brew install git to install git, and brew install node to install Node.js.

Linux/BSD users should use their appropriate package managers to install git and Node.js, or build from source if you swing that way. Easy-peasy.

How to build your own jQuery

Clone a copy of the main jQuery git repo by running:

git clone git://github.com/jquery/jquery.git

Enter the jquery directory and run the build script:

cd jquery && npm run-script build

The built version of jQuery will be put in the dist/ subdirectory, along with the minified copy and associated map file.

If you want create custom build or help with jQuery development, it would be better to install grunt command line interface as a global package:

npm install -g grunt-cli

Make sure you have grunt installed by testing:

grunt -v

Now by running grunt command, in the jquery directory, you could build full version of jQuery, just like with npm run-script build command:

grunt

There are many other tasks avaliable for jQuery Core:

grunt -help

Modules

Special builds can be created that exclude subsets of jQuery functionality. This allows for smaller custom builds when the builder is certain that those parts of jQuery are not being used. For example, an app that only used JSONP for $.ajax() and did not need to calculate offsets or positions of elements could exclude the offset and ajax/xhr modules.

Any module may be excluded except for core, and selector. To exclude a module, pass its path relative to the src folder (without the .js extension).

Some example modules that can be excluded are:

As a special case, you may also replace Sizzle by using a special flag grunt custom:-sizzle.

Note: Excluding Sizzle will also exclude all jQuery selector extensions (such as effects/animatedSelector and css/hiddenVisibleSelectors).

The build process shows a message for each dependent module it excludes or includes.

To create a custom build of the latest stable version, first check out the version:

git pull; git checkout $(git describe --abbrev=0 --tags)

Then, make sure all Node dependencies are installed:

npm install

Create the custom build, use the grunt custom option, listing the modules to be excluded. Examples:

Exclude all ajax functionality:

grunt custom:-ajax

Excluding css removes modules depending on CSS: effects, offset, dimensions.

grunt custom:-css

Exclude a bunch of modules:

grunt custom:-ajax,-css,-deprecated,-dimensions,-effects,-event/alias,-offset,-wrap

For questions or requests regarding custom builds, please start a thread on the Developing jQuery Core section of the forum. Due to the combinatorics and custom nature of these builds, they are not regularly tested in jQuery's unit test process. The non-Sizzle selector engine currently does not pass unit tests because it is missing too much essential functionality.

Running the Unit Tests

Make sure you have the necessary dependencies:

npm install

Start grunt watch or npm start to auto-build jQuery as you work:

cd jquery && grunt watch

Run the unit tests with a local server that supports PHP. Ensure that you run the site from the root directory, not the "test" directory. No database is required. Pre-configured php local servers are available for Windows and Mac. Here are some options:

Building to a different directory

To copy the built jQuery files from /dist to another directory:

grunt && grunt dist:/path/to/special/location/

With this example, the output files would be:

/path/to/special/location/jquery.js
/path/to/special/location/jquery.min.js

To add a permanent copy destination, create a file in dist/ called ".destination.json". Inside the file, paste and customize the following:


{
  "/Absolute/path/to/other/destination": true
}

Additionally, both methods can be combined.

Essential Git

As the source code is handled by the version control system Git, it's useful to know some features used.

cleaning

If you want to purge your working directory back to the status of upstream, following commands can be used (remember everything you've worked on is gone after these):

git reset --hard upstream/master
git clean -fdx

rebasing

For feature/topic branches, you should always use the --rebase flag to git pull, or if you are usually handling many temporary "to be in a github pull request" branches, run following to automate this:

git config branch.autosetuprebase local

(see man git-config for more information)

handling merge conflicts

If you're getting merge conflicts when merging, instead of editing the conflicted files manually, you can use the feature git mergetool. Even though the default tool xxdiff looks awful/old, it's rather useful.

Following are some commands that can be used there:

QUnit Reference

Test methods

expect( numAssertions );
stop();
start();

note: QUnit's eventual addition of an argument to stop/start is ignored in this test suite so that start and stop can be passed as callbacks without worrying about their parameters

Test assertions

ok( value, [message] );
equal( actual, expected, [message] );
notEqual( actual, expected, [message] );
deepEqual( actual, expected, [message] );
notDeepEqual( actual, expected, [message] );
strictEqual( actual, expected, [message] );
notStrictEqual( actual, expected, [message] );
raises( block, [expected], [message] );

Test Suite Convenience Methods Reference (See test/data/testinit.js)

Returns an array of elements with the given IDs

q( ... );

Example:

q("main", "foo", "bar");

=> [ div#main, span#foo, input#bar ]

Asserts that a selection matches the given IDs

t( testName, selector, [ "array", "of", "ids" ] );

Example:

t("Check for something", "//[a]", ["foo", "baar"]);

Fires a native DOM event without going through jQuery

fireNative( node, eventType )

Example:

fireNative( jQuery("#elem")[0], "click" );

Add random number to url to stop caching

url( "some/url.php" );

Example:

url("data/test.html");

=> "data/test.html?10538358428943"

url("data/test.php?foo=bar");

=> "data/test.php?foo=bar&10538358345554"

Load tests in an iframe

Loads a given page constructing a url with fileName: "./data/" + fileName + ".html" and fires the given callback on jQuery ready (using the jQuery loading from that page) and passes the iFrame's jQuery to the callback.

testIframe( fileName, testName, callback );

Callback arguments:

callback( jQueryFromIFrame, iFrameWindow, iFrameDocument );

Load tests in an iframe (window.iframeCallback)

Loads a given page constructing a url with fileName: "./data/" + fileName + ".html" The given callback is fired when window.iframeCallback is called by the page The arguments passed to the callback are the same as the arguments passed to window.iframeCallback, whatever that may be

testIframeWithCallback( testName, fileName, callback );

Questions?

If you have any questions, please feel free to ask on the Developing jQuery Core forum or in #jquery on irc.freenode.net.

Parsed in 2.41 ms or 2 times faster
<h1><a href="http://jquery.com/">jQuery</a> - New Wave JavaScript</h1>
<h2>Contribution Guides</h2>
<p>In the spirit of open source software development, jQuery always encourages community code contribution. To help you get started and before you jump into writing code, be sure to read these important contribution guidelines thoroughly:</p>
<ol>
<li><a href="http://docs.jquery.com/Getting_Involved">Getting Involved</a></li>
<li><a href="http://docs.jquery.com/JQuery_Core_Style_Guidelines">Core Style Guide</a></li>
<li><a href="http://docs.jquery.com/Tips_for_jQuery_Bug_Patching">Tips For Bug Patching</a></li>
</ol>
<h2>What you need to build your own jQuery</h2>
<p>In order to build jQuery, you need to have Node.js/npm latest and git 1.7 or later.
(Earlier versions might work OK, but are not tested.)</p>
<p>For Windows you have to download and install <a href="http://git-scm.com/downloads">git</a> and <a href="http://nodejs.org/download/">Node.js</a>.</p>
<p>Mac OS users should install <a href="http://mxcl.github.com/homebrew/">Homebrew</a>. Once Homebrew is installed, run <code>brew install git</code> to install git,
and <code>brew install node</code> to install Node.js.</p>
<p>Linux/BSD users should use their appropriate package managers to install git and Node.js, or build from source
if you swing that way. Easy-peasy.</p>
<h2>How to build your own jQuery</h2>
<p>Clone a copy of the main jQuery git repo by running:</p>
<pre><code class="language-bash">git clone git://github.com/jquery/jquery.git</code></pre>
<p>Enter the jquery directory and run the build script:</p>
<pre><code class="language-bash">cd jquery &amp;&amp; npm run-script build</code></pre>
<p>The built version of jQuery will be put in the <code>dist/</code> subdirectory, along with the minified copy and associated map file.</p>
<p>If you want create custom build or help with jQuery development, it would be better to install <a href="https://github.com/gruntjs/grunt-cli">grunt command line interface</a> as a global package:</p>
<pre><code>npm install -g grunt-cli</code></pre>
<p>Make sure you have <code>grunt</code> installed by testing:</p>
<pre><code>grunt -v</code></pre>
<p>Now by running <code>grunt</code> command, in the jquery directory, you could build full version of jQuery, just like with <code>npm run-script build</code> command:</p>
<pre><code>grunt</code></pre>
<p>There are many other tasks avaliable for jQuery Core:</p>
<pre><code>grunt -help</code></pre>
<h3>Modules</h3>
<p>Special builds can be created that exclude subsets of jQuery functionality.
This allows for smaller custom builds when the builder is certain that those parts of jQuery are not being used.
For example, an app that only used JSONP for <code>$.ajax()</code> and did not need to calculate offsets or positions of elements could exclude the offset and ajax/xhr modules.</p>
<p>Any module may be excluded except for <code>core</code>, and <code>selector</code>. To exclude a module, pass its path relative to the <code>src</code> folder (without the <code>.js</code> extension).</p>
<p>Some example modules that can be excluded are:</p>
<ul>
<li><strong>ajax</strong>: All AJAX functionality: <code>$.ajax()</code>, <code>$.get()</code>, <code>$.post()</code>, <code>$.ajaxSetup()</code>, <code>.load()</code>, transports, and ajax event shorthands such as <code>.ajaxStart()</code>.</li>
<li><strong>ajax/xhr</strong>: The XMLHTTPRequest AJAX transport only.</li>
<li><strong>ajax/script</strong>: The <code>&lt;script&gt;</code> AJAX transport only; used to retrieve scripts.</li>
<li><strong>ajax/jsonp</strong>: The JSONP AJAX transport only; depends on the ajax/script transport.</li>
<li><strong>css</strong>: The <code>.css()</code> method plus non-animated <code>.show()</code>, <code>.hide()</code> and <code>.toggle()</code>. Also removes <strong>all</strong> modules depending on css (including <strong>effects</strong>, <strong>dimensions</strong>, and <strong>offset</strong>).</li>
<li><strong>deprecated</strong>: Methods documented as deprecated but not yet removed; currently only <code>.andSelf()</code>.</li>
<li><strong>dimensions</strong>: The <code>.width()</code> and <code>.height()</code> methods, including <code>inner-</code> and <code>outer-</code> variations.</li>
<li><strong>effects</strong>: The <code>.animate()</code> method and its shorthands such as <code>.slideUp()</code> or <code>.hide("slow")</code>.</li>
<li><strong>event</strong>: The <code>.on()</code> and <code>.off()</code> methods and all event functionality. Also removes <code>event/alias</code>.</li>
<li><strong>event/alias</strong>: All event attaching/triggering shorthands like <code>.click()</code> or <code>.mouseover()</code>.</li>
<li><strong>offset</strong>: The <code>.offset()</code>, <code>.position()</code>, <code>.offsetParent()</code>, <code>.scrollLeft()</code>, and <code>.scrollTop()</code> methods.</li>
<li><strong>wrap</strong>: The <code>.wrap()</code>, <code>.wrapAll()</code>, <code>.wrapInner()</code>, and <code>.unwrap()</code> methods.</li>
<li><strong>exports/amd</strong>: Exclude the AMD definition.</li>
<li><strong>core/ready</strong>: Exclude the ready module if you place your scripts at the end of the body. Any ready callbacks bound with <code>jQuery()</code> will simply be called immediately. However, <code>jQuery(document).ready()</code> will not be a function and <code>.on("ready", ...)</code> or similar will not be triggered.</li>
<li><strong>deferred</strong>: Exclude jQuery.Deferred. This also removes jQuery.Callbacks. <em>Note</em> that modules that depend on jQuery.Deferred(AJAX, effects, core/ready) will not be removed and will still expect jQuery.Deferred to be there. Include your own jQuery.Deferred implementation or exclude those modules as well (<code>grunt custom:-deferred,-ajax,-effects,-core/ready</code>).</li>
</ul>
<p>As a special case, you may also replace Sizzle by using a special flag <code>grunt custom:-sizzle</code>.</p>
<ul>
<li><strong>sizzle</strong>: The Sizzle selector engine. When this module is excluded, it is replaced by a rudimentary selector engine based on the browser's <code>querySelectorAll</code> method that does not support jQuery selector extensions or enhanced semantics. See the selector-native.js file for details.</li>
</ul>
<p><em>Note</em>: Excluding Sizzle will also exclude all jQuery selector extensions (such as <code>effects/animatedSelector</code> and <code>css/hiddenVisibleSelectors</code>).</p>
<p>The build process shows a message for each dependent module it excludes or includes.</p>
<p>To create a custom build of the latest stable version, first check out the version:</p>
<pre><code class="language-bash">git pull; git checkout $(git describe --abbrev=0 --tags)</code></pre>
<p>Then, make sure all Node dependencies are installed:</p>
<pre><code class="language-bash">npm install</code></pre>
<p>Create the custom build, use the <code>grunt custom</code> option, listing the modules to be excluded. Examples:</p>
<p>Exclude all <strong>ajax</strong> functionality:</p>
<pre><code class="language-bash">grunt custom:-ajax</code></pre>
<p>Excluding <strong>css</strong> removes modules depending on CSS: <strong>effects</strong>, <strong>offset</strong>, <strong>dimensions</strong>.</p>
<pre><code class="language-bash">grunt custom:-css</code></pre>
<p>Exclude a bunch of modules:</p>
<pre><code class="language-bash">grunt custom:-ajax,-css,-deprecated,-dimensions,-effects,-event/alias,-offset,-wrap</code></pre>
<p>For questions or requests regarding custom builds, please start a thread on the <a href="https://forum.jquery.com/developing-jquery-core">Developing jQuery Core</a> section of the forum. Due to the combinatorics and custom nature of these builds, they are not regularly tested in jQuery's unit test process. The non-Sizzle selector engine currently does not pass unit tests because it is missing too much essential functionality.</p>
<h2>Running the Unit Tests</h2>
<p>Make sure you have the necessary dependencies:</p>
<pre><code class="language-bash">npm install</code></pre>
<p>Start <code>grunt watch</code> or <code>npm start</code> to auto-build jQuery as you work:</p>
<pre><code class="language-bash">cd jquery &amp;&amp; grunt watch</code></pre>
<p>Run the unit tests with a local server that supports PHP. Ensure that you run the site from the root directory, not the &quot;test&quot; directory. No database is required. Pre-configured php local servers are available for Windows and Mac. Here are some options:</p>
<ul>
<li>Windows: <a href="http://www.wampserver.com/en/">WAMP download</a></li>
<li>Mac: <a href="http://www.mamp.info/en/index.html">MAMP download</a></li>
<li>Linux: <a href="https://www.linux.com/learn/tutorials/288158-easy-lamp-server-installation">Setting up LAMP</a></li>
<li><a href="http://code.google.com/p/mongoose/">Mongoose (most platforms)</a></li>
</ul>
<h2>Building to a different directory</h2>
<p>To copy the built jQuery files from <code>/dist</code> to another directory:</p>
<pre><code class="language-bash">grunt &amp;&amp; grunt dist:/path/to/special/location/</code></pre>
<p>With this example, the output files would be:</p>
<pre><code class="language-bash">/path/to/special/location/jquery.js
/path/to/special/location/jquery.min.js</code></pre>
<p>To add a permanent copy destination, create a file in <code>dist/</code> called &quot;.destination.json&quot;. Inside the file, paste and customize the following:</p>
<pre><code class="language-json">
{
  "/Absolute/path/to/other/destination": true
}</code></pre>
<p>Additionally, both methods can be combined.</p>
<h2>Essential Git</h2>
<p>As the source code is handled by the version control system Git, it's useful to know some features used.</p>
<h3>cleaning</h3>
<p>If you want to purge your working directory back to the status of upstream, following commands can be used (remember everything you've worked on is gone after these):</p>
<pre><code class="language-bash">git reset --hard upstream/master
git clean -fdx</code></pre>
<h3>rebasing</h3>
<p>For feature/topic branches, you should always use the <code>--rebase</code> flag to <code>git pull</code>, or if you are usually handling many temporary &quot;to be in a github pull request&quot; branches, run following to automate this:</p>
<pre><code class="language-bash">git config branch.autosetuprebase local</code></pre>
<p>(see <code>man git-config</code> for more information)</p>
<h3>handling merge conflicts</h3>
<p>If you're getting merge conflicts when merging, instead of editing the conflicted files manually, you can use the feature
<code>git mergetool</code>. Even though the default tool <code>xxdiff</code> looks awful/old, it's rather useful.</p>
<p>Following are some commands that can be used there:</p>
<ul>
<li><code>Ctrl + Alt + M</code> - automerge as much as possible</li>
<li><code>b</code> - jump to next merge conflict</li>
<li><code>s</code> - change the order of the conflicted lines</li>
<li><code>u</code> - undo a merge</li>
<li><code>left mouse button</code> - mark a block to be the winner</li>
<li><code>middle mouse button</code> - mark a line to be the winner</li>
<li><code>Ctrl + S</code> - save</li>
<li><code>Ctrl + Q</code> - quit</li>
</ul>
<h2><a href="http://docs.jquery.com/QUnit">QUnit</a> Reference</h2>
<h3>Test methods</h3>
<pre><code class="language-js">expect( numAssertions );
stop();
start();</code></pre>
<p>note: QUnit's eventual addition of an argument to stop/start is ignored in this test suite so that start and stop can be passed as callbacks without worrying about their parameters</p>
<h3>Test assertions</h3>
<pre><code class="language-js">ok( value, [message] );
equal( actual, expected, [message] );
notEqual( actual, expected, [message] );
deepEqual( actual, expected, [message] );
notDeepEqual( actual, expected, [message] );
strictEqual( actual, expected, [message] );
notStrictEqual( actual, expected, [message] );
raises( block, [expected], [message] );</code></pre>
<h2>Test Suite Convenience Methods Reference (See <a href="https://github.com/jquery/jquery/blob/master/test/data/testinit.js">test/data/testinit.js</a>)</h2>
<h3>Returns an array of elements with the given IDs</h3>
<pre><code class="language-js">q( ... );</code></pre>
<p>Example:</p>
<pre><code class="language-js">q("main", "foo", "bar");

=&gt; [ div#main, span#foo, input#bar ]</code></pre>
<h3>Asserts that a selection matches the given IDs</h3>
<pre><code class="language-js">t( testName, selector, [ "array", "of", "ids" ] );</code></pre>
<p>Example:</p>
<pre><code class="language-js">t("Check for something", "//[a]", ["foo", "baar"]);</code></pre>
<h3>Fires a native DOM event without going through jQuery</h3>
<pre><code class="language-js">fireNative( node, eventType )</code></pre>
<p>Example:</p>
<pre><code class="language-js">fireNative( jQuery("#elem")[0], "click" );</code></pre>
<h3>Add random number to url to stop caching</h3>
<pre><code class="language-js">url( "some/url.php" );</code></pre>
<p>Example:</p>
<pre><code class="language-js">url("data/test.html");

=&gt; "data/test.html?10538358428943"

url("data/test.php?foo=bar");

=&gt; "data/test.php?foo=bar&amp;10538358345554"</code></pre>
<h3>Load tests in an iframe</h3>
<p>Loads a given page constructing a url with fileName: <code>"./data/" + fileName + ".html"</code>
and fires the given callback on jQuery ready (using the jQuery loading from that page)
and passes the iFrame's jQuery to the callback.</p>
<pre><code class="language-js">testIframe( fileName, testName, callback );</code></pre>
<p>Callback arguments:</p>
<pre><code class="language-js">callback( jQueryFromIFrame, iFrameWindow, iFrameDocument );</code></pre>
<h3>Load tests in an iframe (window.iframeCallback)</h3>
<p>Loads a given page constructing a url with fileName: <code>"./data/" + fileName + ".html"</code>
The given callback is fired when window.iframeCallback is called by the page
The arguments passed to the callback are the same as the
arguments passed to window.iframeCallback, whatever that may be</p>
<pre><code class="language-js">testIframeWithCallback( testName, fileName, callback );</code></pre>
<h2>Questions?</h2>
<p>If you have any questions, please feel free to ask on the
<a href="http://forum.jquery.com/developing-jquery-core">Developing jQuery Core forum</a> or in #jquery on irc.freenode.net.</p>