Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…
Cannot retrieve contributors at this time
150 lines (92 sloc) 7.98 KB

jQuery Mobile

This is the main repository for the jQuery Mobile project. From the official website:

A unified, HTML5-based user interface system for all popular mobile device platforms, built on the rock-solid jQuery and jQuery UI foundation. Its lightweight code is built with progressive enhancement, and has a flexible, easily themeable design.

You can find more information about how the library works, and what it is capable of, by reading the documentation.


When submitting issues on github please include the following:

  1. Issue description
  2. Sample page using our jsbin template
  3. Steps to reproduce
  4. Expected outcome
  5. Actual outcome
  6. Browsers tested
  7. Library version/Location (eg, CDN or

Also, in the interest of creating more readable issues please include code snippets inside a triple backtick box appropriate for the JavaScript/HTML/CSS snippet you wish to discuss. More information is available at the introduction page for github flavored markdown (see, Syntax Highlighting).

Pull Requests

When submitting a pull request for review there are few important steps you can take to ensure that it gets reviewed quickly and increase the chances that it will be merged (in order of descending importance):

  1. Include tests (see Testing)
  2. Follow the jQuery Core style guide
  3. Limit the scope to one Issue/Feature
  4. Small focused commits, ideally less than 10 to 20 lines
  5. Avoid merge commits (see Pro Git's chapter on rebasing, Rebasing)

Taken together, the above reduces the effort that's required of the contributor reviewing your pull request.


Currently the library is shipped on the jQuery CDN/download as a single monolithic JavaScript file that depends on jQuery Core (not included) and a similarly bundled CSS file. For users we support the following build targets:

  • js - resolve dependencies, build, concat, and minify the JavaScript used for jQuery Mobile
  • css - resolve dependencies, build, concat, and minify all the css, just the structure css, and just the theme css
  • docs - build the js and css, and make the docs ready for static consumption
  • zip - package all the JavaScript and all the css into a zip archive


The js and css build targets require node.js and its packaged NPM package manager. For other the other build targets, docs and zip, bash is required. For more information on installing node please see its documentation. As for bash it's generally installed as the default shell in many POSIX compliant environments (OSX, Linux, BSD, etc).


With node installed you can run the js and css targets by simply issuing the following from the project root:

npm install
node node_modules/.gin/grunt js # or css

Note that if you have the appropriate version of grunt, our build tool, installed globally you can substitute grunt wherever you see node node_modules/.gin/grunt. For the remainder of the build documentation we will prefer the more concise grunt.

If you want to use the docs and zip targets you will need bash and they can be run with the following

grunt docs # or grunt zip


As of version 1.1 the library uses dependency management in the JavaScript build by providing AMD modules which can be added or removed from the core mobile meta module js/

For example, if a user wished to exclude the form widgets to reduce the wire weight of their jQuery Mobile include they would first remove them from the meta module:

diff --git a/js/ b/js/
index 6200fe6..3a4625c 100644
--- a/js/
+++ b/js/
@@ -19,12 +19,6 @@ define([
-       './',
-       './',
-       './',
-       './',
-       './',
-       './',

And then run the build:

grunt js


To create a new theme:

  1. Copy the default folder from CSS/Themes to a new folder named after your new theme (eg, my-theme).
  2. Add customizations to the file.
  3. From the project root run the following grunt command:

    THEME=my-theme grunt css

  4. The output will be available in the $PROJECT_ROOT/compiled

Again assumes the theme css files are available in the css/theme/$THEME/ directory relative to the project root.


The root of the repository is also the root of the documentation and, along with the test suite, acts as the test bed for bug fixes and features. You'll need to set up a server and get the test suite running before you can contribute patches.


Most of the documentation and testing pages rely on PHP 5+, and as a result Apache and PHP are required for development. You can install them using one of the following methods:

  • one-click - MAMP for OSX, XAMP for OSX/Windows
  • existing web server - eg, ~/Sites directory on OSX.
  • virtual machine - If Vagrant is installed you can add this remote/branch and vagrant up

In addition to vanilla Apache the following modules are required:

  • Rewrite (
  • Expire (
  • Header (

Once you have your web server setup you can point it at the project directory.


Automated testing forms the backbone of the jQuery Mobile project's QA activities. As a contributor or patch submitter you will be expected to run the test suite in for the area your patches affect. Our continuous integration server will address the remainder of the test suite.

There are two primary ways to run the test suite. First, you can run the tests individually by directing your browser to the different test pages associated with the area in which you are working. For example, to run the tests for js/ visit $WEB_SERVER/tests/unit/slider/. To find out what which test pages are available you can list them with:

grunt config:test:pages

Second you can run the tests using the PhantomJS headless Webkit browser which must be installed. Once phantomjs is in the your PATH the following will execute the whole test suite:

JUNIT_OUTPUT=build/test-results/ ROOT_DOMAIN=$WEB_SERVER grunt test

You can confine the headless run to a single test page or set of test pages using the TEST_PATH environment variable. For example:

TEST_PATH=slider JUNIT_OUTPUT=build/test-results/ ROOT_DOMAIN=$WEB_SERVER grunt test

will only run the tests where the path contains the string slider, eg tests/unit/slider/. NOTE That the phantom tests currently require that the web server be running to access and run the tests properly because of the PHP dependency that many of them share. Additionally the test suite is run against many versions of jQuery using the JQUERY environment variable. For example if you wanted to run the test suite against both of the currently supported versions 1.6.4, and 1.7.1 the command would take the following form:

JQUERY=1.6.4,1.7.1 JUNIT_OUTPUT=build/test-results/ ROOT_DOMAIN=$WEB_SERVER grunt test


Jump to Line
Something went wrong with that request. Please try again.