diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..b7ca95b5 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,5 @@ +# Auto detect text files and perform LF normalization +* text=auto + +# JS files must always use LF for tools to work +*.js eol=lf diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml new file mode 100644 index 00000000..5309c6fa --- /dev/null +++ b/.github/workflows/node.js.yml @@ -0,0 +1,31 @@ +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs + +name: Node.js CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + # Old infra requires Node 10 + node-version: [10.x, 18.x] + + steps: + - name: Install xmllint + run: sudo apt-get install -y libxml2-utils + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - run: npm ci + - run: npm test diff --git a/.gitignore b/.gitignore index b5a693a5..633f1bde 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,3 @@ -dist -node_modules -config.json -.project -*~ -*.diff -*.patch -.DS_Store -.settings \ No newline at end of file +/dist/ +/node_modules/ +config.js* diff --git a/.mailmap b/.mailmap new file mode 100644 index 00000000..283d1215 --- /dev/null +++ b/.mailmap @@ -0,0 +1 @@ +Anne-Gaelle Colom diff --git a/.npmrc b/.npmrc new file mode 100644 index 00000000..cffe8cde --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +save-exact=true diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 630bbc3d..d6d55695 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,4 +2,4 @@ Welcome! Thanks for your interest in contributing to api.jquerymobile.com. You'r You may also want to take a look at our [commit & pull request guide](http://contribute.jquery.org/commits-and-pull-requests/) and [style guides](http://contribute.jquery.org/style-guide/) for instructions on how to maintain your fork and submit your code. Before we can merge any pull request, we'll also need you to sign our [contributor license agreement](http://contribute.jquery.org/cla). -You can find us on [IRC](http://irc.jquery.org), specifically in [#jquerymobile-dev](irc://irc.freenode.net/#jquerymobile-dev) and [#jquery-content](irc://irc.freenode.net/#jquery-content) should you have any questions. If you've never contributed to open source before, we've put together [a short guide with tips, tricks, and ideas on getting started](http://contribute.jquery.org/open-source/). +You can find us on [IRC](http://irc.jquery.org), specifically in #jqueryui-dev and #jquery-content should you have any questions. If you've never contributed to open source before, we've put together [a short guide with tips, tricks, and ideas on getting started](http://contribute.jquery.org/open-source/). diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 00000000..fa66dfde --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,46 @@ +module.exports = function( grunt ) { + +grunt.loadNpmTasks( "grunt-jquery-content" ); + +grunt.initConfig({ + xmllint: { + all: [ + "entries/**", + "includes/**", + "categories.xml", + "entries2html.xsl", + "notes.xsl" + ] + }, + "build-posts": { + page: "pages/**" + }, + "build-xml-entries": { + all: "entries/**" + }, + "build-resources": { + all: "resources/**" + }, + wordpress: (function() { + + // There's no config for CI, but we don't need one for basic testing + var config = {}; + try { + config = require( "./config" ); + } catch ( error ) {} + config.dir = "dist/wordpress"; + return config; + })() +}); + +grunt.registerTask( "lint", [ "xmllint" ] ); + +grunt.registerTask( "build", [ + "build-posts", + "build-resources", + "build-xml-entries", + "build-xml-categories", + "build-xml-full" +]); + +}; diff --git a/LICENSE-MIT.txt b/LICENSE.txt similarity index 62% rename from LICENSE-MIT.txt rename to LICENSE.txt index 8240d81d..47cd4a24 100644 --- a/LICENSE-MIT.txt +++ b/LICENSE.txt @@ -1,8 +1,13 @@ -Copyright (c) 2013 jQuery Foundation, http://jquery.org/ +Copyright jQuery Foundation and other contributors, https://jquery.org/ This software consists of voluntary contributions made by many individuals. For exact contribution history, see the revision history -and logs, available at http://github.com/jquery/api.jquerymobile.com +available at https://github.com/jquery/api.jquerymobile.com + +The following license applies to all parts of this software except as +documented below: + +==== Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -22,3 +27,18 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation and all examples and demos. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +All files located in the node_modules directory are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/README.md b/README.md index de73f94d..c5288026 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,12 @@ -api.jquerymobile.com -==================== +# api.jquerymobile.com -## Building +## Building and Deploying -### Requirements -* libxml2 -* libxslt - -The `xmllint` and `xsltproc` utilities need to be in your path. If you are on Windows, you can get libxml2 and libxslt from GnuWin32. +To build and deploy your changes for previewing in a [`jquery-wp-content`](https://github.com/jquery/jquery-wp-content) instance, follow the [workflow instructions](http://contribute.jquery.org/web-sites/#workflow) from our documentation on [contributing to jQuery Foundation web sites](http://contribute.jquery.org/web-sites/). -### Build +### Requirements -To build and deploy your changes for previewing in a [`jquery-wp-content`](https://github.com/jquery/jquery-wp-content) instance, follow the [workflow instructions](http://contribute.jquery.org/web-sites/#workflow) from our documentation on [contributing to jQuery Foundation web sites](http://contribute.jquery.org/web-sites/). +* [libxml2](http://xmlsoft.org/) +* [libxslt](http://xmlsoft.org/libxslt/) +The `xmllint` and `xsltproc` utilities need to be in your path. If you are on Windows, you can get libxml2 and libxslt from GnuWin32. diff --git a/categories.xml b/categories.xml index 9ba46297..7b3b3db9 100644 --- a/categories.xml +++ b/categories.xml @@ -2,7 +2,22 @@ @@ -12,9 +27,20 @@ + + + - - + + + + + + Button Widget Creates a button widget - -

Buttons are coded with standard HTML anchor and input elements, then enhanced by jQuery Mobile to make them more attractive and useable on a mobile device. Use anchor links (a elements) to mark up navigation buttons, and input or button elements for form submission.

- -

Styling links as buttons

-

In the main content block of a page, you can style any anchor link as a button by adding the data-role="button" attribute. The framework will enhance the link with markup and classes to style the link as a button. For example, this markup:

- -

-<a href="index.html" data-role="button">Link button</a>
-
- -

Produces this link-based button: -

- -

Note: Links styled like buttons have all the same visual options as true form-based buttons below, but there are a few important differences. Link-based buttons aren't part of the button plugin and only just use the underlying buttonMarkup plugin to generate the button styles so the form button methods (enable, disable, refresh) aren't supported. If you need to disable a link-based button (or any element), it's possible to apply the disabled class ui-disabled yourself with JavaScript to achieve the same effect.

- -

-<a href="index.html" data-role="button" class="ui-disabled">Link button</a>
-
- -

Produces this disabled link-based button: - -

- -

Mini version

- -

For a more compact version that is useful in toolbars and tight spaces, add the data-mini="true" attribute to the button to create a mini version.

- -

-<a href="index.html" data-role="button" data-mini="true">Link button</a>
-
- -

This will produce a button that is not as tall as the standard version and has a smaller text size. - -

- -

Form buttons

- -

For ease of styling, the framework automatically converts any button or input element with a type of submit, reset, or button into a custom styled button - there is no need to add the data-role="button" attribute. However, if needed, you can directly call the button plugin on any selector, just like any jQuery plugin:

- -

-$( "[type='submit']" ).button();
-
- -

Button based button:

- -
	
-<button>Button element</button>
-
- - - -

Input type="button" based button:

-
	
-<input type="button" value="Button" />
-
- - - -

Input type="submit" based button:

-

-<input type="submit" value="Submit Button" />
-
- - - -

Input type="reset" based button:

-

-<input type="reset" value="Reset Button" />
-
- - - -

Adding Icons to Buttons

-

The jQuery Mobile framework includes a selected set of icons most often needed for mobile apps. To minimize download size, jQuery Mobile includes a single white icon sprite, and automatically adds a semi-transparent black circle behind the icon to ensure that it has good contrast on any background color.

- - -

An icon can be added to a button by adding a data-icon attribute on the anchor specifying the icon to display. For example, the following markup:

- -

-<a href="index.html" data-role="button" data-icon="delete">Delete</a>
-
- - - -

Icon set

- -

The full list of data-icon attributes can found on the icons reference page

. - -

Icon positioning

-

By default, all icons in buttons are placed to the left of the button text. -

- -

This default may be overridden using the data-iconpos attribute to set the icon to the right, above (top) or below (bottom) the text. For example, the markup:

-

-<a href="index.html" data-role="button" data-icon="delete" data-iconpos="right">Delete</a>
-
- - - -

You can also create an icon-only button, by setting the data-iconpos attribute to notext. The button plugin will hide the text on-screen, but add it as a title attribute on the link to provide context for screen readers and devices that support tooltips. For example, replacing data-iconpos="right" on the previous example with data-iconpos="notext":

- -

-<a href="index.html" data-role="button" data-icon="delete" data-iconpos="notext">Delete</a>
-
- -

Creates this icon-only button: -

- -

Mini & Inline

-

The mini and inline attributes can be added to produce more compact buttons: -

- -

Custom Icons

-

To use custom icons, specify a data-icon value that has a unique name like myapp-email and the button plugin will generate a class by prefixing ui-icon- to the data-icon value and apply it to the button: ui-icon-myapp-email.

-

You can then write a CSS rule in your stylesheet that targets the ui-icon-myapp-email class to specify the icon background source. To maintain visual consistency with the rest of the icons, create a white icon 18x18 pixels saved as a PNG-8 with alpha transparency.

-

In this example, we're just pointing to a standalone icon image, but you could just as easily use an icon sprite and specify the positioning instead, just like the icon sprite we use in the framework.

- -
.ui-icon-myapp-email {
-	background-image: url( "app-icon-email.png" );
-}
- -

This will create the standard resolution icon, but many devices now have very high resolution displays, like the retina display on the iPhone 4. To add a HD icon, create an icon that is 36x36 pixels (exactly double the 18 pixel size), and add second a rule that uses the -webkit-min-device-pixel-ratio: 2 media query to target a rule only to high resolution displays. Specify the background image for the HD icon file and set the background size to 18x18 pixels which will fit the 36 pixel icon into the same 18 pixel space. The media query block can wrap multiple icon rules:

-

-@media only screen and (-webkit-min-device-pixel-ratio: 2) {
-	.ui-icon-myapp-email {
-		background-image: url( "app-icon-email-highres.png" );
-		background-size: 18px 18px;
-	}
-	...more HD icon rules go here...
-}
-
- -

Inline buttons

- -

By default, all buttons in the body content are styled as block-level elements so they fill the width of the screen: -

- - -

If you have multiple buttons that should sit side-by-side on the same line, add the data-inline="true" attribute to each button. This will style the buttons to be the width of their content and float the buttons so they sit on the same line.

- -

-<a href="index.html" data-role="button" data-inline="true">Cancel</a>
-<a href="index.html" data-role="button" data-inline="true" data-theme="b">Save</a>
-
- - - - -

If you want buttons to sit side-by-side but stretch to fill the width of the screen, you can use the content column grids to put normal full-width buttons into 2- or 3-columns.

- -

Icon example

- - - -

Grouped buttons

- -

Occasionally, you may want to visually group a set of buttons to form a single block that looks contained like a navigation component. To get this effect, wrap a set of buttons in a container with the data-role="controlgroup" attribute - the framework will create a vertical button group, remove all margins and drop shadows between the buttons, and only round the first and last buttons of the set to create the effect that they are grouped together.

- -

-<div data-role="controlgroup">
-	<a href="index.html" data-role="button">Yes</a>
-	<a href="index.html" data-role="button">No</a>
-	<a href="index.html" data-role="button">Maybe</a>
-</div>
-
- -

By default, grouped buttons are presented as a vertical list: -

- -

By adding the data-type="horizontal" attribute to the controlgroup container, you can swap to a horizontal-style group that floats the buttons side-by-side and sets the width to only be large enough to fit the content. (Be aware that these will wrap to multiple lines if the number of buttons or the overall text length is too wide for the screen.)

- -

-

- -

Labels

-

Because the label element will be associated with each individual input or button and will be hidden for styling purposes, we recommend wrapping the buttons in a fieldset element that has a legend which acts as the combined label for the group. Using the label as a wrapper around an input prevents the framework from hiding it, so you have to use the for attribute to associate the label with the input.

- -

Theming buttons

- -

jQuery Mobile has a rich theming system that gives you full control of how buttons are styled. When a link is added to a container, it is automatically assigned a theme swatch letter that matches its parent bar or content box to visually integrate the button into the parent container, like a chameleon. So a button placed inside a content container with a theme of "a" (black in the default theme) will be automatically assigned the button theme of "a" (charcoal in the default theme). Here are examples of the button theme pairings in the default theme. All buttons have the same HTML markup: -

- -

Assigning theme swatches

-

Buttons can be manually assigned any of the button color swatches from the theme to add visual contrast with the container they sit inside by adding the data-theme attribute on the button markup and specifying a swatch letter.

- -
			
-<a href="index.html" data-role="button" data-theme="a">Swatch a</a>			
-
- -

Here are 5 buttons with icons that have a different swatch letter assigned via the data-theme attribute. -

- -

Theme variations

- -

- -
+ +

The jQuery UI button widget is bundled in jQuery Mobile with some changes. Thus, its API documentation fully describes its functionality.

+
1.0 - + - + - + - - - - triggered when a form button is created - - - - - - - - - enable a disabled form button. -

-$( "[type='submit']" ).button( "enable" );
-
-
-
- - disable a form button. -

-$( "[type='submit']" ).button( "disable" );
-
-
-
- - update the form button. -

If you manipulate a form button via JavaScript, you must call the refresh method on it to update the visual styling.

-

-$( "[type='submit']" ).button( "refresh" );
-
-
-
-
- - - A basic example of a button - - diff --git a/entries/checkboxradio.xml b/entries/checkboxradio.xml index 48be0d96..99363bae 100644 --- a/entries/checkboxradio.xml +++ b/entries/checkboxradio.xml @@ -1,277 +1,28 @@ - + Checkboxradio Widget Creates a checkboxradio widget -

Checkboxes

-

Checkboxes are used to provide a list of options where more than one can be selected. Traditional desktop checkboxes are not optimized for touch input so in jQuery Mobile, we style the label for the checkboxes so they are larger and look clickable. A custom set of icons are added to the label to provide additional visual feedback.

-

The checkbox controls below use standard input/label markup, but are styled to be more touch-friendly. The styled control you see is actually the label element, which sits over the real input, so if images fail to load, you'll still have a functional control. In most browsers, clicking the label automatically triggers a click on the input, but we've had to trigger the update manually for a few mobile browsers that don't do this natively. On the desktop, these controls are keyboard and screen-reader accessible.

-

To create a single checkbox, add an input with a type="checkbox" attribute and a corresponding label. If the input isn’t wrapped in its corresponding label, be sure to set the for attribute of the label to match the id of the input so they are semantically associated.

- -

-<label><input type="checkbox" name="checkbox-0" /> I agree </label>
-
-<input type="checkbox" name="checkbox-1" id="checkbox-1" class="custom" />
-<label for="checkbox-1">I agree</label>
-
-

The above snippets will produce two basic checkboxes. The default styles will set the width of the element to 100% of the parent container. -

- -

Mini version

- -

For a more compact version that is useful in toolbars and tight spaces, add the data-mini="true" attribute to the element to create a mini version.

- -

-<input type="checkbox" name="checkbox-mini" id="checkbox-mini-1" class="custom" data-mini="true" />
-<label for="checkbox-mini-1">I agree</label>
-
- -

This will produce a checkbox that is not as tall as the standard version and has a smaller text size. -

- -

Field containers & Legends

- -

Because checkboxes use the label element for the text displayed next to the checkbox form element, we recommend wrapping the checkbox in a fieldset element that has a legend which acts as the title for the question. Add the data-role="controlgroup" attribute to the fieldset so it can be styled in a parallel way as text inputs, selects or other form elements.

- -

-<div data-role="fieldcontain">
-	<fieldset data-role="controlgroup">
-		<legend>Agree to the terms:</legend>
-		<input type="checkbox" name="checkbox-2" id="checkbox-2" class="custom" />
-		<label for="checkbox-2">I agree</label>
-	</fieldset>
-</div>
-
- - -

Vertically grouped checkboxes

- -

Typically, there are multiple checkboxes listed under a question title. To visually integrate multiple checkboxes into a grouped button set, the framework will automatically remove all margins between buttons and round only the top and bottom corners of the set if there is a data-role="controlgroup" attribute on the fieldset.

- -

-<div data-role="fieldcontain">
-	<fieldset data-role="controlgroup">
-		<legend>Choose as many snacks as you'd like:</legend>
-			<input type="checkbox" name="checkbox-1a" id="checkbox-1a" class="custom" />
-			<label for="checkbox-1a">Cheetos</label>
-    	            
-			<input type="checkbox" name="checkbox-2a" id="checkbox-2a" class="custom" />
-			<label for="checkbox-2a">Doritos</label>
-			
-			<input type="checkbox" name="checkbox-3a" id="checkbox-3a" class="custom" />
-			<label for="checkbox-3a">Fritos</label>
-	
-			<input type="checkbox" name="checkbox-4a" id="checkbox-4a" class="custom" />
-			<label for="checkbox-4a">Sun Chips</label>
-		</fieldset>
-</div>
-
- - - -

Horizontal toggle sets

- -

Checkboxes can also be used for grouped button sets where more than one button can be selected at once, such as the bold, italic and underline button group seen in word processors. To make a horizontal button set, add the data-type="horizontal" to the fieldset.

- -

-<div data-role="fieldcontain">
-	<fieldset data-role="controlgroup" data-type="horizontal">
-		<legend>Font styling:</legend>
-		<input type="checkbox" name="checkbox-6" id="checkbox-6" class="custom" />
-		<label for="checkbox-6">b</label>
-	
-		<input type="checkbox" name="checkbox-7" id="checkbox-7" class="custom" />
-		<label for="checkbox-7"><em>i</em></label>
-
-		<input type="checkbox" name="checkbox-8" id="checkbox-8" class="custom" />
-		<label for="checkbox-8">u</label>    
-	</fieldset>
-</div>
-
- -

The framework will float the labels so they sit side-by-side on a line, hide the checkbox icons and only round the left and right edges of the group.

- -

Radio buttons

-

Radio buttons are used to provide a list of options where only a single item can be selected. Traditional desktop radio buttons are not optimized for touch input so jQuery Mobile styles the label for the radio buttons so they are larger and look clickable. A custom set of icons are added to the label to provide additional visual feedback.

-

The radio button controls below use standard input/label markup, but are styled to be more touch-friendly. The styled control you see is actually the label element, which sits over the real input, so if images fail to load, you'll still have a functional control. In most browsers, clicking the label automatically triggers a click on the input, but we've had to trigger the update manually for a few mobile browsers that don't do this natively. On the desktop, these controls are keyboard and screen-reader accessible.

- -

Vertically grouped radio buttons

- -

To create a set of radio buttons, add an input with a type="radio" attribute and a corresponding label. Set the for attribute of the label to match the id of the input so they are semantically associated.

-

The label element is displayed next to the radio form element. Wrap the radio buttons in a fieldset element that has a legend which acts as the title for the question.

-

To visually integrate multiple radio buttons into a vertically grouped button set, the framework will automatically remove all margins between buttons and round only the top and bottom corners of the set if there is a data-role="controlgroup" attribute on the container.

- -

-<fieldset data-role="controlgroup">
-	<legend>Choose a pet:</legend>
-	<input type="radio" name="radio-choice" id="radio-choice-1" value="choice-1" checked="checked" />
-	<label for="radio-choice-1">Cat</label>
-
-	<input type="radio" name="radio-choice" id="radio-choice-2" value="choice-2" />
-	<label for="radio-choice-2">Dog</label>
-
-	<input type="radio" name="radio-choice" id="radio-choice-3" value="choice-3" />
-	<label for="radio-choice-3">Hamster</label>
-
-	<input type="radio" name="radio-choice" id="radio-choice-4" value="choice-4" />
-	<label for="radio-choice-4">Lizard</label>
-</fieldset>
-
- -

This will produce a vertically grouped radio button set. The default styles set the width of the button group to 100% of the parent container and stacks the label on a separate line. -

- -

Mini version

- -

For a more compact version that is useful in toolbars and tight spaces, add the data-mini="true" attribute to the element to create a mini version.

- -

-<fieldset data-role="controlgroup" data-mini="true">
-	<input type="radio" name="radio-mini" id="radio-mini-1" value="choice-1" checked="checked" />
-	<label for="radio-mini-1">Credit</label>
-
-	<input type="radio" name="radio-mini" id="radio-mini-2" value="choice-2" />
-	<label for="radio-mini-2">Debit</label>
-
-	<input type="radio" name="radio-mini" id="radio-mini-3" value="choice-3" />
-	<label for="radio-mini-3">Cash</label>
-</fieldset>
-
- -

This will produce a radio button that is not as tall as the standard version and has a smaller text size. -

- -

Field containers

- -

Optionally wrap the radiobuttons in a container with the data-role="fieldcontain" attribute to help visually group it in a longer form.

- -

-<div data-role="fieldcontain">
-	<fieldset data-role="controlgroup">
-		<legend>Choose a pet:</legend>
-		<input type="radio" name="radio-choice-2" id="radio-choice-21" value="choice-1" checked="checked" />
-		<label for="radio-choice-1">Cat</label>
-
-		<input type="radio" name="radio-choice-2" id="radio-choice-22" value="choice-2" />
-		<label for="radio-choice-2">Dog</label>
-
-		<input type="radio" name="radio-choice-2" id="radio-choice-23" value="choice-3" />
-		<label for="radio-choice-3">Hamster</label>
-
-		<input type="radio" name="radio-choice-2" id="radio-choice-24" value="choice-4" />
-		<label for="radio-choice-4">Lizard</label>
-	</fieldset>
-</div>
-
- - - -

Horizontal radio button sets

- -

Radio buttons can also be used for grouped button sets where only a single button can be selected at once, such as a view switcher control. To make a horizontal radio button set, add the data-type="horizontal" to the fieldset.

- -

-<fieldset data-role="controlgroup" data-type="horizontal" >
-
- - - -

The labels float so they sit side-by-side on a line. The radio button icons are hidden and only the left and right edges of the group are rounded.

- +

The jQuery UI checkboxradio widget is bundled in jQuery Mobile with some changes. Thus, its API documentation fully describes its functionality.

1.0 - - - - triggered when a checkboxradio is created - - - - - - - - - enable a disabled checkboxradio. - - - - disable a checkboxradio. - - - - $( ".selector" ).prop( "checked", true ).checkboxradio( "refresh" ); - - update the checkboxradio. -

If you manipulate a checkboxradio via JavaScript, you must call the refresh method on it to update the visual styling.

-
-
-
- - A basic example of a checkbox in a fieldcontainer - - - - 300 - A basic example of vertically grouped radio buttons - -
diff --git a/entries/classes.xml b/entries/classes.xml new file mode 100644 index 00000000..22b38e33 --- /dev/null +++ b/entries/classes.xml @@ -0,0 +1,212 @@ + + + + Classes + CSS classes for common styles + +

Style Classes

+

jQuery Mobile uses the following style classes:

+ + + + + + + + + + + + + + + + + +
ui-corner-all
Adds rounded corners to the element.
ui-shadow
Adds an item shadow around the element.
ui-overlay-shadow
Adds an overlay shadow around the element. The intended effect is for the element to appear to float above other elements.
ui-mini
Reduces the font size and scales down paddings proportionally to produce a miniature version of the element for use in toolbars and tight spaces.
+

These classes can be applied any of the framework's widgets.

+

Widget-specific classes

+ + + + + + + + + +
ui-collapsible-inset
The collapsible widget has horizontal margins, borders, and rounded corners when this class is applied.
ui-listview-inset
The listview widget has horizontal margins, borders, and rounded corners when this class is applied.
+

Button-specific classes

+

In addition to the style classes, you can add the following classes to a (anchor) and button elements to render them touch-friendly:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Basic options
ui-btn
You must add this class to indicate that the element is to be styled as a button. This is a prerequisite for adding any other button-related classes.
ui-btn-inline
Displays the button inline. This means that it will only consume as much space as is needed for the label. This allows you to place buttons side by side, flowing with the text.
ui-shadow-icon
Draws a shadow around the icon.
Icon positioning
ui-btn-icon-top
The icon appears above the text
ui-btn-icon-right
The icon appears to the right of the text
ui-btn-icon-bottom
The icon appears below the text
ui-btn-icon-left
The icon appears to the left of the text
ui-btn-icon-notext
The button text is suppressed, and only the icon is shown. The result is a circular button the size of the icon.
Theme
ui-btn-[a-z]
Sets the color scheme (swatch) for the button. Use a single letter from a-z that maps to the swatches included in your theme. For example: ui-btn-b
+

Icon classes

+

Icons are used by a variety of widgets. The table below lists all the available icon classes. The widgets which support an icon usually have an option named "icon". The value for that option is the name of the icon, which is appended to the prefix ui-icon- to create the icon class name. In the class list below, the icon names are emphasized as part of the icon class name.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ui-icon-alert
An exclamation mark inside a triangle.
ui-icon-arrow-l
An arrow pointing left (←).
ui-icon-arrow-r
An arrow pointing right (→).
ui-icon-arrow-u
An arrow pointing up (↑).
ui-icon-arrow-d
An arrow pointing down (↓).
ui-icon-back
A curved arrow arcing counterclockwise upwards.
ui-icon-bars
Three horizontal bars one above the other.
ui-icon-carat-b
A carat pointing down (v).
ui-icon-carat-l
A carat pointing left (<).
ui-icon-carat-r
A carat pointing right (>).
ui-icon-carat-t
A carat pointing up (^).
ui-icon-check
A checkmark (✓).
ui-icon-delete
A diagonal cross similar to (✕).
ui-icon-edit
A pencil - similar to (✎) but pointing to the lower left.
ui-icon-forward
A curved arrow arcing clockwise upwards.
ui-icon-gear
A gear (⚙).
ui-icon-grid
A 3✕3 grid.
ui-icon-home
A house similar to (⌂).
ui-icon-minus
A "minus" sign (-).
ui-icon-plus
A "plus" sign (+).
ui-icon-refresh
A circular arrow similar to (⟳).
ui-icon-search
A magnifying glass.
ui-icon-star
A star similar to (✭).
+

Theme-related classes

+

The class prefixes in the table below are used for applying a swatch to various parts of the user interface. The actual class name is constructed by appending the swatch letter (a-z) to the prefix. For example, the class ui-body-a is the swatch applied to the page.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ui-bar-[a-z]
Sets the color scheme (swatch) for a bar. This includes headers and footers, or bars you include in the page.
ui-body-[a-z]
Sets the color scheme (swatch) for a content block. This includes page content panes (deprecated as of 1.4.0), listview items, popups, collapsibles, the loader widget, sliders, and panels.
ui-btn-[a-z]
Sets the color scheme (swatch) for a button.
ui-group-theme-[a-z]
Sets the color scheme (swatch) for controlgroups, listviews, and collapsible sets (accordions).
ui-overlay-[a-z]
Sets the color scheme (swatch) for backgrounds such as those of popup widgets, and page containers.
ui-page-theme-[a-z]
Sets the color scheme (swatch) for pages.
ui-panel-page-container-[a-z]
Panels temporarily set the theme on the page container using this class.
+
+ +
diff --git a/entries/collapsible-set.xml b/entries/collapsible-set.xml deleted file mode 100644 index 44eebc86..00000000 --- a/entries/collapsible-set.xml +++ /dev/null @@ -1,170 +0,0 @@ - - - - Collapsible set Widget - Creates a collapsible set of collapsible blocks of content - -

Collapsible sets start with the exact same markup as individual collapsibles. - By adding a parent wrapper with a data-role="collapsible-set" attribute around a number of collapsibles, the framework will style these to looks like a visually grouped widget and make it behave like an accordion so only one section can be open at a time.

-

By default, all the sections will be collapsed. To set a section to be open when the page loads, add the data-collapsed="false" attribute to the heading of the section you want expanded.

- -

-<div data-role="collapsible-set">
-
-	<div data-role="collapsible" data-collapsed="false">
-		<h3>Section 1</h3>
-		<p>I'm the collapsible set content for section 1.</p>
-	</div>
-
-	<div data-role="collapsible">
-		<h3>Section 2</h3>
-		<p>I'm the collapsible set content for section 2.</p>
-	</div>
-
-</div>
-
- - -

Here is an example of a collapsible set with 5 sections. -

- -

Non-inset collapsible sets

- -

For full width collapsibles without corner styling add the data-inset="false" attribute to the set. -

- -

Mini collapsible sets

- -

For a more compact version that is useful in tight spaces, add the data-mini="true" attribute to the set to create a mini version. -

- -

Custom icons

- -

Collapsible headings’ default icons can be overridden by using the data-collapsed-icon and data-expanded-icon attributes, either at the collapsible-set level or on an individual collapsible basis. -

- -

Icon positioning

- -

Collapsible headings’ default icon positioning can be overridden by using the data-iconpos attribute, either at the collapsible-set level or on an individual collapsible basis. -

- -

Theming collapsible content

- -

The standard data-theme attribute can be used to set the color of each collapsible in a set. To provide a clearer visual grouping of the content with the headers, add the data-content-theme attribute with a swatch letter. This adds a themed background color and border to the content block. For consistent theming, add these attributes to the parent collapsible set. - -

<div data-role="collapsible-set" data-theme="c" data-content-theme="d">
-
- -

- -

Theming individual sections

- -

To have individual sections in a group styled differently, add data-theme and data-content-theme attributes to specific collapsibles. -

- -

Expanding or collapsing items in a set

- -

To expand or collapse items in a set, call the respective methods on individual collapsibles. The selector for the collapse method can include multiple items in a set:

- -

-$( "#myCollapsibleSet" ).children().trigger( "collapse" );
-
- -
- 1.0 - - - - - - - - - - - - - Triggered when a collapsible set is created - - - - - - - - - Updates the collapsible set. -

If you manipulate a collapsible set via JavaScript (e.g. add new collapsible containers), you must call the refresh method on it to update the visual styling.

-
-
-
- - A basic example of a collapsible set. - - - -
diff --git a/entries/collapsible.xml b/entries/collapsible.xml index b5fc7846..2ce0a80e 100644 --- a/entries/collapsible.xml +++ b/entries/collapsible.xml @@ -1,192 +1,258 @@ - + Collapsible Widget Creates a collapsible block of content -

To create a collapsible block of content, create a container and add the data-role="collapsible" attribute. Using data-content-theme attribute allows you to set a theme for the content of the collapsible.

+

Collapsible content

+ Note: Collapsible is deprecated as of version 1.5 and will be removed in version 1.6. Use accordion in place of collapsible. +

To create a collapsible block of content, create a container and add the data-role="collapsible" attribute. Using the data-content-theme attribute allows you to set a theme for the content of the collapsible.

Directly inside this container, add any header (H1-H6) or legend element. The framework will style the header to look like a clickable button and add a "+" icon to the left to indicate it's expandable.

After the header, add any HTML markup you want to be collapsible. The framework will wrap this markup in a container that will be hidden/shown when the heading is clicked.

By default, the content will be collapsed.

-

-<div data-role="collapsible">
-	<h3>I'm a header</h3>
-	<p>I'm the collapsible content. By default I'm closed, but you can click the header to open me.</p>
-</div>
-	
+

This code will create a collapsible widget like this: - +

- -

Expanding collapsibles on load

-

To expand the content when the page loads, add the data-collapsed="false" attribute to the wrapper.

+ + +
    +
  • + ui-collapsible: The outermost container for collapsible. Contains additional classes of ui-collapsible-inset, ui-collapsible-themed-content and ui-collapsible-collapsed by default unless options to set them false are added. +
      +
    • + ui-collapsible-heading: Always visible part of collapsible, which is clicked to open it. Additionally contains ui-collapsible-heading-collapsed class when the collapsible is closed. +
        +
      • + ui-collapsible-heading-toggle: Toggler for collapsible +
          +
        • + ui-collapsible-heading-status: Status text of the toggler +
        • +
        +
      • +
      +
    • +
    • + ui-collapsible-content: Content of the collapsible. Additionally contains ui-collapsible-content-collapsed class in case the content is collapsed. +
    • +
    +
  • +
+ +

Initially expanded collapsibles

-

-<div data-role="collapsible" data-collapsed="false">
-
+

When you add the data-collapsed="false" attribute to the wrapper the collapsible will initially be expanded.

+ +

This code will create a collapsible widget like this: -

- +

+

Non-inset collapsibles

By default collapsibles have an inset appearance. To make them full width without corner styling add the data-inset="false" attribute to the element.

-

-<div data-role="collapsible" data-inset="false">
-
+

This code will create a non-inset collapsible:

- +

Mini collapsibles

-

For a more compact version that is useful in toolbars and tight spaces, add the data-mini="true" attribute to the element to create a mini version.

+

For a more compact version that is useful in toolbars and tight spaces, add the data-mini="true" attribute to the element to create a mini version.

+ +
-

-<div data-role="collapsible" data-mini="true">
-
-

This code will create a mini collapsible widget:

- +

Custom icons

-

Collapsible headings’ default icons can be overridden by using the data-collapsed-icon and data-expanded-icon attributes. In the below case, data-collapsed-icon="arrow-r" and data-expanded-icon="arrow-d". -

- +

The default icon of collapsible headings can be overridden by using the data-collapsed-icon and data-expanded-icon attributes. The example below uses data-collapsed-icon="arrow-r" and data-expanded-icon="arrow-d". +

+

Icon positioning

-

Collapsible headings’ default icon positioning can be overridden by using the data-iconpos attribute. In the below case, data-iconpos="right". -

- +

The default icon positioning of collapsible headings can be overridden by using the data-iconpos attribute. The example below uses data-iconpos="right". +

+

Theming collapsible content

-

Collapsible content is minimally styled - we add only a bit of margin between the bar and content, and the header adopts the default theme styles of the container it sits within.

- -

To provide a stronger visual connection between the collapsible header and content, add the data-content-theme attribute to the wrapper and specify a theme swatch letter. This will apply the swatch's border and flat background color (not the gradient) to the content block and changes the corner rounding to square off the bottom of the header and round the bottom of the content block instead to visually group these elements.

- -

-<div data-role="collapsible" data-content-theme="c">
-	<h3>Header</h3>
-	<p>I'm the collapsible content with a themed content block set to "c".</p>
-</div>
-
+

Collapsible content is minimally styled - we add only a bit of margin between the bar and content, and the header adopts the default theme styles of the container within which it sits.

- +

To provide a stronger visual connection between the collapsible header and content, add the data-content-theme attribute to the wrapper and specify a theme swatch letter. This applies the border and background color of the swatch to the content block and changes the corner rounding to square off the bottom of the header and round the bottom of the content block instead to visually group these elements.

+ +
+ +

Theming collapsible headers

To set the theme on a collapsible header button, add the data-theme attribute to the wrapper and specify a swatch letter. Note that you can mix and match swatch letters between the header and content with these theme attributes.

-
<div data-role="collapsible" data-theme="a" data-content-theme="a">
-	<h3>Header swatch A</h3>
-	<p>I'm the collapsible content with a themed content block set to "a".</p>
-</div>
-
+
- +

Nested Collapsibles

Collapsibles can be nested inside each other if needed. In this example, we're setting the content theme to provide clearer visual connection between the levels. -

- +

+

Collapsible sets (accordions)

-

It's possible to combine multiple collapsibles into a grouped set that acts like an accordion widget.

+

It's possible to combine multiple collapsibles into a grouped set that acts like an accordion widget.

+ + +

The widget creates an anchor from the heading element and wraps the rest of the children of the outermost widget in a div that will serve as the container for the collapsible content.

+

In the example below, pre-rendered markup for a is provided. The attribute data-collapsed-icon="arrow-r" is explicitly specified, since the use of theui-icon-arrow-r class on the anchor element indicates that the value of the "collapsedIcon" widget option is to be "arrow-r".

+ +
+ +
1.0 + + + + + + - - - - Triggered when a collapsible is created - - - - - - - - + Triggered when a collapsible is collapsed @@ -209,6 +275,20 @@ $( document ).on( "mobileinit", function() { + + + Collapses the . + + + + + + + + Expands the . + + + A basic example of a collapsible content block. @@ -217,7 +297,7 @@ $( document ).on( "mobileinit", function() {

jQuery Mobile Example

-
+

I'm a header

I'm the collapsible content. By default I'm closed, but you can click the header to open me.

diff --git a/entries/collapsibleset.xml b/entries/collapsibleset.xml new file mode 100644 index 00000000..5e319276 --- /dev/null +++ b/entries/collapsibleset.xml @@ -0,0 +1,194 @@ + + + + Collapsibleset Widget + Creates a set of collapsible blocks of content + +

Sets of collapsibles

+

jQuery Mobile will visually style a set of collapsibles as a group and will make the set behave like an accordion in that only one collapsible can be open at a time if you wrap the collapsibles in a div that has the attribute data-role="collapsibleset".

+ +

By default, all the collapsible sections will be collapsed. To set a section to be open when the page loads, add the data-collapsed="false" attribute to the heading of the section you want expanded.

+ +
+ +

Here is an example of a widget with 5 sections. +

+ +

Non-inset widgets

+ +

For full width collapsibles without corner styling add the data-inset="false" attribute to the set. +

+ +

Mini widgets

+ +

For a more compact version that is useful in tight spaces, add the data-mini="true" attribute to the set to create a mini version. +

+ +

Custom icons

+ +

The icon displayed when a collapsible is shown or hidden can be overridden by using the data-collapsed-icon and data-expanded-icon attributes. Both the collapsibleset widget and the collapsible widget accepts these attributes. When you set one or both of these attributes on the collapsibleset widget all collapsible widgets that are part of the collapsibleset display the icon specified by the chosen value. You can override the icon displayed by individual collapsible widgets by setting one or both of these attributes on the collapsible widget itself. +

+ +

Icon positioning

+ +

The default icon positioning for collapsible headings can be overridden by using the data-iconpos attribute. You can set the attribute either on the collapsibleset to affect all collapsibles in the set, or on an individual collapsible widget to affect only the one widget. +

+ +

Theming collapsible content

+ +

The standard data-theme attribute can be used to set the color of each collapsible in a set. To provide a clearer visual grouping of the content with the headers, add the data-content-theme attribute with a swatch letter. This adds a themed background color and border to the content block. For consistent theming, add these attributes to the parent widget. + +

+ +

+ +

Theming individual sections

+ +

To have individual sections in a group styled differently, add data-theme and data-content-theme attributes to specific collapsibles. +

+ + +

The widget does not require that the collapsibles it contains also be pre-rendered.

+

In the example below, pre-rendered markup for a is provided. The attribute data-corners="false" is explicitly specified, since the absence of the ui-corner-all class on the container element indicates that the "corners" widget option is to be false. One of the child collapsibles is provided as-is, while the other is pre-rendered.

+ +
+ + + +
+ 1.0 + + + + + + + + + + + + + + + + + + + + + + + Updates the widget. +

If you manipulate a widget via JavaScript (e.g. by adding new collapsibles, removing old ones, or showing/hiding existing ones), you must call the refresh method on it to update the visual styling. This method will instantiate collapsibles on child elements which are marked data-role="collapsible", so there is no need to manually call .collapsible().

+ +
+
+
+ + A basic example of a widget. + + + +
diff --git a/entries/controlgroup.xml b/entries/controlgroup.xml index 96c38edd..84357af9 100644 --- a/entries/controlgroup.xml +++ b/entries/controlgroup.xml @@ -1,58 +1,18 @@ - + Controlgroup Widget Groups buttons together. - -

Occasionally, you may want to visually group a set of buttons to form a single block that looks contained like a navigation component. To get this effect, wrap a set of buttons in a container with the data-role="controlgroup" attribute — the framework will create a vertical button group, remove all margins and drop shadows between the buttons, and only round the first and last buttons of the set to create the effect that they are grouped together.

- -

-<div data-role="controlgroup">
-  <a href="#" data-role="button">Yes</a>
-  <a href="#" data-role="button">No</a>
-  <a href="#" data-role="button">Maybe</a>
-</div>
-
- -

This will result in the following button group: -

-

By adding the data-type="horizontal" attribute to the controlgroup container, you can swap to a horizontal-style group that floats the buttons side-by-side and sets the width to only be large enough to fit the content. (Be aware that these will wrap to multiple lines if the number of buttons or the overall text length is too wide for the screen.)

- -

Horizontal grouped buttons: -

- -

Labels

-

If you use a controlgroup for input, button or select buttons we recommend wrapping them in a fieldset element that has a legend which acts as the combined label for the group. The label elements of each individual button in the group will be hidden for styling purposes, and are only accessible by screen readers. Using the label as a wrapper around the form element prevents the framework from hiding it, so you have to use the for attribute to associate the label with the input.

- + +

The jQuery UI controlgroup widget is bundled in jQuery Mobile with some changes. Thus, its API documentation fully describes its functionality.

1.3 - - - - - - Triggered when a controlgroup is created. - - - - - - Obtain the container element within which the controlgroup's child elements are to be placed. -

+			
+
- - A basic example of a controlgroup. - - diff --git a/entries/dialog.xml b/entries/dialog.xml index 7e5462e0..06e8b7e6 100644 --- a/entries/dialog.xml +++ b/entries/dialog.xml @@ -1,43 +1,45 @@ - + Dialog Widget Opens content in an interactive overlay. +
+ Note: Dialogs are deprecated as of jQuery Mobile 1.4.0 and will be removed in 1.5.0. The dialog option provided by the page.dialog extension of the page widget allows you to style a page as a dialog, however, the special navigational handling will be removed. You may also consider implementing dialogs using popup widgets.

Any page can be presented as a modal dialog by adding the data-rel="dialog" attribute to the page anchor link. When the "dialog" attribute is applied, the framework adds styles to add rounded corners, margins around the page and a dark background to make the "dialog" appear to be suspended above the page.

-

-<a href="foo.html" data-rel="dialog">Open dialog</a>
-
+

You can open a dialog programmatically by calling the $.mobile.changePage method:

-

-// Dialog loaded via AJAX
+

Transitions

By default, the dialog will open with a 'pop' transition. Like all pages, you can specify any page transition you want on the dialog by adding the data-transition attribute to the link. To make it feel more dialog-like, we recommend specifying a transition of "pop", "slidedown" or "flip".
Possible values include: fade, pop, flip, turn, flow, slidefade, slide, slideup, slidedown, none.

-

-<a href="foo.html" data-rel="dialog" data-transition="pop">Open dialog</a>
-
+

Closing dialogs

When any link is clicked within a dialog, the framework will automatically close the dialog and transition to the requested page, just as if the dialog were a normal page. Nevertheless, dialogs can also be chained, as explained below under "Chaining Dialogs". Similarly, a link that opens a popup will also leave the dialog in place.

- +

If the dialog has a header the framework will add a close button at the left side of the header. You can change the position by adding data-close-btn="right" to the dialog container. If you don't want a close button in the header or add a custom close button, you can use data-close-btn="none".

- + - +

To create a "cancel" button in a dialog, just link to the page that triggered the dialog to open and add the data-rel="back" attribute to your link. This pattern of linking to the previous page is also usable in non-JS devices as well.

For JavaScript-generated links, you can simply set the href attribute to "#" and use the data-rel="back" attribute. You can also call the dialog's close() method to programmatically close dialogs, for example: $( ".ui-dialog" ).dialog( "close" ).

@@ -59,9 +61,9 @@ $.mobile.changePage( "#myDialog", { role: "dialog" } );

Dialogs can be styled with different theme swatches, just like any page by adding data-theme attributes to the header, content, or footer containers.

- +

By default dialogs have rounded corners. The option corners can be set to false by adding data-corners="false" to the dialog container:

- +

Dialogs appear to be floating above an overlay layer. This overlay adopts the swatch 'a' content color by default, but the data-overlay-theme attribute can be added to the page wrapper to set the overlay to any swatch letter.

@@ -76,7 +78,7 @@ $.mobile.changePage( "#myDialog", { role: "dialog" } );

For the sake of readability, dialogs have a default width of 92.5% and a max-width of 500 pixels. There is also a 10% top margin to give dialogs larger top margin on larger screens, but collapse to a small margin on smartphones. The dialog's inner container is shifted towards the top with 15px to hide the corner styling if a dialog is used as a control sheet (see above). To override these styles, add the following CSS override rule to your stylesheet and tweak as needed:

-

+
1.0 @@ -99,32 +101,25 @@ $.mobile.changePage( "#myDialog", { role: "dialog" } ); - -
+]]>

Scroll to a particular Y position without triggering scroll event listeners.

- \ No newline at end of file + diff --git a/entries/jqmData.xml b/entries/jqmData.xml index 89ab8d5f..db1926ae 100644 --- a/entries/jqmData.xml +++ b/entries/jqmData.xml @@ -6,11 +6,12 @@

When working with jQuery Mobile, jqmData should be used in place of jQuery core's data method (note that this includes $.fn.data, $.fn.removeData, and the $.data, $.removeData, and $.hasData utilities), as they automatically incorporate getting and setting of namespaced data attributes (even if no namespace is currently in use). + Note: jqmData is deprecated as of version 1.5 and will be removed in version 1.6.

Arguments:
-
See jQuery's data method
+
See jQuery's data method
Note:
Calling jqmData() with no argument will return undefined. This behavior is subject to change in future versions.
Also:
diff --git a/entries/jqmEnhanceable.xml b/entries/jqmEnhanceable.xml deleted file mode 100644 index 3f2c2ce6..00000000 --- a/entries/jqmEnhanceable.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - jqmEnhanceable() - Filter method to respect data-enhance=false parent elements during manual enhancement. - - - -

For users that wish to respect data-enhance=false parent elements during manual enhancement or custom plugin authoring jQuery Mobile provides the $.fn.jqmEnhanceable filter method. -

-
-
-
Settings:
-
If, and only if, $.mobile.ignoreContentEnabled is set to true, this method will traverse the parent nodes for each DOM element in the jQuery object and where it finds a data-enhance=false parent the child will be removed from the set.
-
Warning:
-
The operation of traversing all parent elements can be expensive for even small jQuery object sets.
-
-
-
- -
\ No newline at end of file diff --git a/entries/jqmHijackable.xml b/entries/jqmHijackable.xml deleted file mode 100644 index f8180e66..00000000 --- a/entries/jqmHijackable.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - jqmHijackable() - For users that wish to respect data-ajax=false parent elements during custom form and link binding jQuery Mobile provides the $.fn.jqmHijackable filter method. - - - -

For users that wish to respect data-ajax=false parent elements during custom form and link binding jQuery Mobile provides the $.fn.jqmHijackable filter method. -

-
-
-
Settings:
-
If, and only if, $.mobile.ignoreContentEnabled is set to true, this method will traverse the parent nodes for each DOM element in the jQuery object and where it finds a data-ajax=false parent, the child form or link will be removed from the set.
-
Warning:
-
The operation of traversing all parent elements can be expensive for even small jQuery object sets.
-
-
-
- -
diff --git a/entries/jqmRemoveData.xml b/entries/jqmRemoveData.xml deleted file mode 100644 index e6ea53fe..00000000 --- a/entries/jqmRemoveData.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - jqmRemoveData() - Remove a previously-stored piece of data. - - - -

When working with jQuery Mobile, jqmRemoveData should be used in place of jQuery core's removeData method (note that this includes $.fn.data, $.fn.removeData, and the $.data, $.removeData, and $.hasData utilities), as they automatically incorporate getting and setting of namespaced data attributes (even if no namespace is currently in use). -

-
-
-
Arguments:
-
See jQuery's removeData method
-
-
-
- -
diff --git a/entries/listview.xml b/entries/listview.xml index bb006d8b..9b657eeb 100644 --- a/entries/listview.xml +++ b/entries/listview.xml @@ -1,30 +1,73 @@ - + Listview Widget Creates a listview widget

Basic linked lists

-

A listview is coded as a simple unordered list containing linked list items with a data-role="listview" attribute. jQuery Mobile will apply all the necessary styles to transform the list into a mobile-friendly listview with right arrow indicator that fills the full width of the browser window. When you tap on the list item, the framework will trigger a click on the first link inside the list item, issue an Ajax request for the URL in the link, create the new page in the DOM, then kick off a page transition. View the data- attribute reference to see all the possible attributes you can add to listviews.

+

A listview is coded as a simple unordered list containing linked list items with a data-role="listview" attribute. jQuery Mobile will apply all the necessary styles to transform the list into a mobile-friendly listview with right arrow indicator that fills the full width of the browser window. When you tap on the list item, the framework will trigger a click on the first link inside the list item, issue an Ajax request for the URL in the link, create the new page in the DOM, then kick off a page transition. View the data- attribute reference to see all the possible attributes you can add to listviews.

Here is the HTML markup for a basic linked list.

-

-<ul data-role="listview">
-	<li><a href="acura.html">Acura</a></li>
-	<li><a href="audi.html">Audi</a></li>
-	<li><a href="bmw.html">BMW</a></li>
-</ul>
-
+
-

+

-

Style note on non-inset lists: all standard, non-inset lists have a -15px margin to negate the 15px of padding on the content area to make lists extend to the edges of the screen. If you add other widgets above or below a list, the negative margin may make these elements overlap so you'll need to add additional spacing in your custom CSS.

- -

Nested lists

-

By nesting child ul or ol inside list items, you can create nested lists. When a list item with a child list is clicked, the framework will show a new page populated with the title of the parent in the header and the list of child elements. These dynamic nested lists are styled with the "b" theme swatch (blue in the default theme) to indicate that you are in a secondary level of navigation. Lists can be nested multiple levels deep and all pages and linking will be automatically handled by the framework. Note that the page of each nested listview is created when the parent page loads and for each nested page the page-events will trigger. Please also note that the title of subpages will contain the text of the first element in the parent list item including its elements. So make sure to use a single element for the list item caption and put other elements like count bubbles behind that caption as shown in the demo below.

-

To set the swatch color of the child listviews, set the data-theme attribute on each list inside.

-
Note: Nested lists are deprecated in version 1.3.0
-

+ + + +
    +
  • + ui-listview: Outermost container for listview widget +
      +
    • + ui-listview-item-static: Simplest list item of listview when there are no anchor tags nested inside an item +
    • +
    • + ui-listview-item-divider: List item element which is a divider +
    • +
    • + ui-listview-item-has-alternate: List item element which has more than one anchor elements +
        +
      • + ui-listview-item-button: First anchor element + +
      • +
      • + ui-listview-item-split-button: Last anchor element +
          +
        • + ui-listview-item-split-icon: Icon of last anchor element +
        • +
        +
      • +
      +
    • +
    • + ui-listview-item: List item element which has only one anchor elements. If the listview item has count bubble, it will additionally have ui-listview-item-has-count class. +
        +
      • + ui-listview-item-button: Anchor element of the list item + +
      • +
      • + ui-listview-item-icon: Icon for the list item +
      • +
      • + ui-listview-item-count-bubble: Count bubble for list item if present +
      • +
      +
    • +
    +
  • +
+ +

Style note on non-inset lists: all standard, non-inset lists have a -1em (16px) margin to negate the 1em padding on the content area to make lists extend to the edges of the screen. If you add other widgets above or below a list, the negative margin may make these elements overlap so you'll need to add additional spacing in your custom CSS.

Numbered lists

Lists can also be created from ordered lists (ol) which is useful when presenting items that are in a sequence such as search results or a movie queue. When the enhanced markup is applied to the listview, jQuery Mobile will try to first use CSS to add numbers to the list and, if not supported, will fall back to injecting numbers with JavaScript.

@@ -32,18 +75,18 @@

Read-only lists

-

Listviews can also be used to display a non-interactive list of items, usually as an inset list. This list is built from an unordered or ordered list that don't have linked list items. The framework styles the list items as buttons like the other list types (see theming lists), but without a gradient on the background.

+

Listviews can also be used to display a non-interactive list of items, usually as an inset list. This list is built from an unordered or ordered list that don't have linked list items. The framework styles static list items identically to list items containing links, but static items receive the body background color (ui-body-a) rather than the button background color (ui-btn-a).

-

+

Split button lists

In cases where there is more than one possible action per list item, a split button can be used to offer two independently clickable items - the list item and a small arrow icon in the far right. To make a split list item, simply add a second link inside the li and the framework will add a vertical divider line, style the link as an icon-only arrow button, and set the title attribute of the link to the text of the link for accessibility.

-

You can set the icon for the right split icon by specifying a data-split-icon attribute on the listview with an icon name you want. The default icon is "arrow-r" but can be configured with the splitIcon listview option. By adding a data-icon attribute to the list item, you can set individual icons for each split. The theme swatch color of the split button defaults to "b" (blue in the default theme) but can be set by specifying a swatch letter with the data-split-theme attribute at the listview level or for individual splits with the data-theme attribute at the link level.

+

You can set the icon for the right split icon by specifying a data-split-icon attribute on the listview with an icon name you want. The default icon is "carat-r" but can be configured with the splitIcon listview option. By adding a data-icon attribute to the list item, you can set individual icons for each split. The theme swatch color of the split button defaults to "b" (blue in the default theme) but can be set by specifying a swatch letter with the data-split-theme attribute at the listview level or for individual splits with the data-theme attribute at the link level.

List dividers

-

List items can be turned into dividers to organize and group the list items. This is done by adding the data-role="list-divider" to any list item. These items are styled with the bar swatch "b" by default (blue in the default theme) but you can specify a theme for dividers by adding the data-divider-theme attribute to the list element (ul or ol) and specifying a theme swatch letter.

+

List items can be turned into dividers to organize and group the list items. This is done by adding the data-role="list-divider" to any list item. These items are styled with the bar swatch "b" by default (blue in the default theme) but you can specify a theme for dividers by adding the data-divider-theme attribute to the list element (ul or ol) and specifying a theme swatch letter.

@@ -53,51 +96,52 @@

By default, the text used to create dividers is the uppercased first letter of the item's text. Alternatively you can specify divider text by setting the autodividersSelector option on the listview programmatically. For example, to add a custom selector to the element with id="mylistview":

-

+

Note that if you are using formatted list items that contain a floating element (for example ui-li-aside), this element precedes its siblings regardless of the order in your HTML markup. This results in the first character of the floating element being used as divider text. Therefore it is recommended to specify the divider text in this case.

- +

If new list items are added to the list or removed from it, the dividers are not automatically updated: you should call refresh() on the listview to redraw the autodividers.

+

Hiding dividers

+

The listview hidedividers extension provides the option hideDividers. When set to true, and you call .listview( "refresh" ) after hiding a list item by adding the class ui-screen-hidden to it, the extension will hide those dividers that are followed immediately by another divider.

+

+

Search filter

-

jQuery Mobile provides a very easy way to filter a list with a simple client-side search feature. To make a list filterable, simply add the data-filter="true" attribute to the list. The framework will then append a search box above the list and add the behavior to filter out list items that don't contain the current search string as the user types. The input's placeholder text defaults to "Filter items...". To configure the placeholder text in the search input, you can either bind to the mobileinit event and set the $.mobile.listview.prototype.options.filterPlaceholder option to a string of your choosing, or use the data attribute data-filter-placeholder on your listview. By default the search box will inherit its theme from its parent. The search box theme can be configured using the data attribute data-filter-theme on your listview.

+

As of jQuery Mobile 1.4.0 this functionality has been transferred to the filterable widget, which provides a more generic solution.

+

Note: Features such as automatic text input generation and special handling of listview dividers are deprecated as of 1.4.0. The documentation for filterable describes the migration path for listviews.

-

+

Filter reveal

-

If you want to change the way in which list items are filtered, i.e. fuzzy search or matching from the beginning of the string, you can configure the callback used internally by defining $.mobile.listview.prototype.options.filterCallback during mobileinit or after the widget has been created with $( "#mylist" ).listview( "option", "filterCallback", yourFilterFunction). Any function defined for the callback will be provided three arguments. First, the text of the current list item, second the value being searched for, and third the list item being filtered. A truthy value will result in a hidden list item. The default callback which filters entries without the searchValue as a substring is described below: -

+

The filter reveal feature makes is easy to build a simple autocomplete with local data. When a filterable list has the data-filter-reveal="true" attribute, it will auto-hide all the list items when the search field is blank. The data-filter-placeholder attribute can be added to specify the placeholder text for the filter. If you need to search against a long list of values, we provide a way to create a filter with a remote data source.

-

-function( text, searchValue, item ) {
-  return text.toString().toLowerCase().indexOf( searchValue ) === -1;
-};
-
+

-

To filter list items by values other than the text, add a data-filtertext attribute to the list item. The value of this attribute will be passed as the first argument to the filterCallback function instead of the text. Alternately you can use an attribute of your choosing as defined on the list item itself.

+

Remote autocomplete with listview filter

-

By default, the listview filter simply searches against the content in each list item. If you want the filter to search against different content, add the data-filtertext attribute to the item and populate it with one or many keywords and phrases that should be used to match against. Note that if this attribute is added, the contents of the list item are ignored.

-

This attribute is useful for dealing with allowing for ticker symbols and full company names to be searched, or for covering common spellings and abbreviations for countries.

- -
		
-<li data-filtertext="NASDAQ:AAPL Apple Inc."><a href="#">Apple</a></li>
-<li data-filtertext="USA U.S.A. United States of America"><a href="#">United States</a></li>
-
+

To use the filter as an autocomplete that taps into remote data sources, you can use the filterablebeforefilter event to dynamically populate a listview as a user types a search query. This is useful when you have a very large data set like cities, zip codes, or products that can't be loaded up-front locally. Use the view source button to see the JavaScript that powers this demo.

-

+

If you have a small list of items, you can use the listview filter reveal option to make an autocomplete with local listview data.

+ +

+ + +

Cities worldwide

+ +

After you enter at least three characters the autocomplete function will show all possible matches.

Text formatting & counts

The framework includes text formatting conventions for common list patterns like header/descriptions, secondary information and counts through semantic HTML markup.

@@ -107,147 +151,170 @@ function( text, searchValue, item ) {
  • To add text hierarchy, use headings to increase font emphasis and use paragraphs to reduce emphasis.
  • Supplemental information can be added to the right of each list item by wrapping content in an element with a class of ui-li-aside
  • - +

    -

    - +

    +

    Thumbnails & icons

    To add thumbnails to the left of a list item, simply add an image inside a list item as the first child element. The framework will scale the image to 80 pixels square. To use standard 16x16 pixel icons in list items, add the class of ui-li-icon to the image element.

    - +

    -

    +

    Inset lists

    -

    If lists are embedded in a page with other types of content, an inset list packages the list into a block that sits inside the content area with a bit of margin and rounded corners (theme controlled). By adding the data-inset="true" attribute to the list (ul or ol), applies the inset appearance.

    +

    If lists are embedded in a page with other types of content, an inset list packages the list into a block that sits inside the content area with a bit of margin and rounded corners (theme controlled). By adding the data-inset="true" attribute to the list (ul or ol), applies the inset appearance.

    -

    - -

    Filter reveal

    - -

    The filter reveal feature makes is easy to build a simple autocomplete with local data. When a filterable list has the data-filter-reveal="true" attribute, it will auto-hide all the list items when the search field is blank. The data-filter-placeholder attribute can be added to specify the placeholder text for the filter. If you need to search against a long list of values, we provide a way to create a filter with a remote data source.

    - -

    - -

    Remote autocomplete with listview filter

    - -

    To use the listview filter as an autocomplete that taps into remote data sources, you can use the listviewbeforefilter event to dynamically populate a listview as a user types a search query. This is useful when you have a very large data set like cities, zip codes, or products that can't be loaded up-front locally. Use the view source button to see the JavaScript that powers this demo.

    - -

    If you have a small list of items, you can use the listview filter reveal option to make an autocomplete with local listview data.

    - -

    - -

    Cities worldwide

    -

    After you enter at least three characters the autocomplete function will show all possible matches.

    +

    Calling the listview plugin

    You can directly call the listview plugin on any selector, just like any jQuery plugin:

    -
    
    +

    Updating lists

    -

    If you add items to a listview, you'll need to call the refresh() method on it to update the styles and create any nested lists that are added. For example:

    -
    
    +			

    If you add items to a listview, you'll need to call the refresh() method on it to update the styles. For example:

    +

    Note that the refresh() method only affects new nodes appended to a list. This is done for performance reasons. Any list items already enhanced will be ignored by the refresh process. This means that if you change the contents or attributes on an already enhanced list item, these won't be reflected. If you want a list item to be updated, replace it with fresh markup before calling refresh.

    - +

    If you initially want to hide a list item you can do this by adding a class of ui-screen-hidden to the li element. Using this class ensures the corner styling is applied correctly as well as border-bottom on the last visible item.

    1.0 -
    +
    ]]>
    diff --git a/entries/navigate.xml b/entries/navigate.xml index d4180e0f..1dcb7d5d 100644 --- a/entries/navigate.xml +++ b/entries/navigate.xml @@ -1,9 +1,9 @@ navigate - A wrapper event for both hashchange and popstate + A wrapper event for popstate -

    The navigate event is a wrapper around both the hashchange and popstate events. In addition to providing a single event for all browsers it also provides a data object in both cases allowing for the unification of handlers. This feature is used by the $.mobile.navigate method to include directionality and URL information.

    +

    The navigate event is a wrapper around popstate event. In addition to providing a single event for all browsers it also provides a data object in both cases allowing for the unification of handlers. This feature is used by the $.mobile.navigate method to include directionality and URL information.

    Change the hash fragment twice then log the data provided with the navigate event when the browser moves backward through history. NOTE: The state will not be provided by default in browsers that only support hashchange. For that functionality please see the navigate method docs. diff --git a/entries/orientationchange.xml b/entries/orientationchange.xml index aa0438fd..9ed96ad5 100644 --- a/entries/orientationchange.xml +++ b/entries/orientationchange.xml @@ -19,7 +19,7 @@ - 90 + 490 Visit this from your orientation-enabled device to see it in action! +

    + +

    You can programmatically close a page styled as a dialog by navigating to another page. For example, you can use the pagecontainer change method: +

    + +

    You can also simply go back: +

    + 1.0 + + + + + + + + + + -