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" } ); - -
+

+ +

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 + + + + + + + + + + -