Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

continuing to remove jquery references to our doc #28779

Merged
merged 4 commits into from
May 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion site/content/docs/4.3/components/alerts.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ Alerts can also contain additional HTML elements like headings, paragraphs and d
Using the alert JavaScript plugin, it's possible to dismiss any alert inline. Here's how:

- Be sure you've loaded the alert plugin, or the compiled Bootstrap JavaScript.
- If you're building our JavaScript from source, it [requires `util.js`]({{< docsref "/getting-started/javascript#util" >}}). The compiled version includes this.
- Add a dismiss button and the `.alert-dismissible` class, which adds extra padding to the right of the alert and positions the `.close` button.
- On the dismiss button, add the `data-dismiss="alert"` attribute, which triggers the JavaScript functionality. Be sure to use the `<button>` element with it for proper behavior across all devices.
- To animate alerts when dismissing them, be sure to add the `.fade` and `.show` classes.
Expand Down
2 changes: 0 additions & 2 deletions site/content/docs/4.3/components/carousel.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ In browsers where the [Page Visibility API](https://www.w3.org/TR/page-visibilit

Please be aware that nested carousels are not supported, and carousels are generally not compliant with accessibility standards.

Lastly, if you're building our JavaScript from source, it [requires `util.js`]({{< docsref "/getting-started/javascript#util" >}}).

## Example

Carousels don't automatically normalize slide dimensions. As such, you may need to use additional utilities or custom styles to appropriately size content. While carousels support previous/next controls and indicators, they're not explicitly required. Add and customize as you see fit.
Expand Down
2 changes: 0 additions & 2 deletions site/content/docs/4.3/components/dropdowns.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ Dropdowns are toggleable, contextual overlays for displaying lists of links and

Dropdowns are built on a third party library, [Popper.js](https://popper.js.org/), which provides dynamic positioning and viewport detection. Be sure to include [popper.min.js]({{< param "cdn.popper" >}}) before Bootstrap's JavaScript or use `bootstrap.bundle.min.js` / `bootstrap.bundle.js` which contains Popper.js. Popper.js isn't used to position dropdowns in navbars though as dynamic positioning isn't required.

If you're building our JavaScript from source, it [requires `util.js`]({{< docsref "/getting-started/javascript#util" >}}).

## Accessibility

The [<abbr title="Web Accessibility Initiative">WAI</abbr> <abbr title="Accessible Rich Internet Applications">ARIA</abbr>](https://www.w3.org/TR/wai-aria/) standard defines an actual [`role="menu"` widget](https://www.w3.org/WAI/PF/aria/roles#menu), but this is specific to application-like menus which trigger actions or functions. <abbr title="Accessible Rich Internet Applications">ARIA</abbr> menus can only contain menu items, checkbox menu items, radio button menu items, radio button groups, and sub-menus.
Expand Down
2 changes: 0 additions & 2 deletions site/content/docs/4.3/components/navs.md
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,6 @@ Add dropdown menus with a little extra HTML and the [dropdowns JavaScript plugin

Use the tab JavaScript plugin—include it individually or through the compiled `bootstrap.js` file—to extend our navigational tabs and pills to create tabbable panes of local content, even via dropdown menus.

If you're building our JavaScript from source, it [requires `util.js`]({{< docsref "/getting-started/javascript#util" >}}).

Dynamic tabbed interfaces, as described in the [<abbr title="Web Accessibility Initiative">WAI</abbr> <abbr title="Accessible Rich Internet Applications">ARIA</abbr> Authoring Practices](https://www.w3.org/TR/wai-aria-practices/#tabpanel), require `role="tablist"`, `role="tab"`, `role="tabpanel"`, and additional `aria-` attributes in order to convey their structure, functionality and current state to users of assistive technologies (such as screen readers).

Note that dynamic tabbed interfaces should <em>not</em> contain dropdown menus, as this causes both usability and accessibility issues. From a usability perspective, the fact that the currently displayed tab's trigger element is not immediately visible (as it's inside the closed dropdown menu) can cause confusion. From an accessibility point of view, there is currently no sensible way to map this sort of construct to a standard WAI ARIA pattern, meaning that it cannot be easily made understandable to users of assistive technologies.
Expand Down
1 change: 0 additions & 1 deletion site/content/docs/4.3/components/popovers.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ Things to know when using the popover plugin:

- Popovers rely on the 3rd party library [Popper.js](https://popper.js.org/) for positioning. You must include [popper.min.js]({{< param "cdn.popper" >}}) before bootstrap.js or use `bootstrap.bundle.min.js` / `bootstrap.bundle.js` which contains Popper.js in order for popovers to work!
- Popovers require the [tooltip plugin]({{< docsref "/components/tooltips" >}}) as a dependency.
- If you're building our JavaScript from source, it [requires `util.js`]({{< docsref "/getting-started/javascript#util" >}}).
- Popovers are opt-in for performance reasons, so **you must initialize them yourself**.
- Zero-length `title` and `content` values will never show a popover.
- Specify `container: 'body'` to avoid rendering problems in more complex components (like our input groups, button groups, etc).
Expand Down
1 change: 0 additions & 1 deletion site/content/docs/4.3/components/scrollspy.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ toc: true

Scrollspy has a few requirements to function properly:

- If you're building our JavaScript from source, it [requires `util.js`]({{< docsref "/getting-started/javascript#util" >}}).
- It must be used on a Bootstrap [nav component]({{< docsref "/components/navs" >}}) or [list group]({{< docsref "/components/list-group" >}}).
- Scrollspy requires `position: relative;` on the element you're spying on, usually the `<body>`.
- When spying on elements other than the `<body>`, be sure to have a `height` set and `overflow-y: scroll;` applied.
Expand Down
25 changes: 12 additions & 13 deletions site/content/docs/4.3/components/toasts.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ Toasts are lightweight notifications designed to mimic the push notifications th

Things to know when using the toast plugin:

- If you're building our JavaScript from source, it [requires `util.js`]({{< docsref "/getting-started/javascript#util" >}}).
- Toasts are opt-in for performance reasons, so **you must initialize them yourself**.
- **Please note that you are responsible for positioning toasts.**
- Toasts will automatically hide if you do not specify `autohide: false`.
Expand Down Expand Up @@ -220,7 +219,10 @@ When using `autohide: false`, you must add a close button to allow users to dism
Initialize toasts via JavaScript:

{{< highlight js >}}
$('.toast').toast(option)
var toastElList = [].slice.call(document.querySelectorAll('.toast'))
var toastList = toastElList.map(function (toastEl) {
return new bootstrap.Toast(toastEl, option)
})
{{< /highlight >}}

### Options
Expand Down Expand Up @@ -266,28 +268,24 @@ Options can be passed via data attributes or JavaScript. For data attributes, ap
{{< partial "callout-danger-async-methods.md" >}}
{{< /callout >}}

#### `$().toast(options)`

Attaches a toast handler to an element collection.

#### `.toast('show')`
#### show

Reveals an element's toast. **Returns to the caller before the toast has actually been shown** (i.e. before the `shown.bs.toast` event occurs).
You have to manually call this method, instead your toast won't show.

{{< highlight js >}}$('#element').toast('show'){{< /highlight >}}
{{< highlight js >}}toast.show(){{< /highlight >}}

#### `.toast('hide')`
#### hide

Hides an element's toast. **Returns to the caller before the toast has actually been hidden** (i.e. before the `hidden.bs.toast` event occurs). You have to manually call this method if you made `autohide` to `false`.

{{< highlight js >}}$('#element').toast('hide'){{< /highlight >}}
{{< highlight js >}}toast.hide(){{< /highlight >}}

#### `.toast('dispose')`
#### dispose

Hides an element's toast. Your toast will remain on the DOM but won't show anymore.

{{< highlight js >}}$('#element').toast('dispose'){{< /highlight >}}
{{< highlight js >}}toast.dispose(){{< /highlight >}}

### Events

Expand Down Expand Up @@ -319,7 +317,8 @@ Hides an element's toast. Your toast will remain on the DOM but won't show anymo
</table>

{{< highlight js >}}
$('#myToast').on('hidden.bs.toast', function () {
var myToastEl = document.getElementById('myToast')
myToastEl.addEventListener('hidden.bs.toast', function () {
// do something...
})
{{< /highlight >}}
57 changes: 31 additions & 26 deletions site/content/docs/4.3/components/tooltips.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ toc: true
Things to know when using the tooltip plugin:

- Tooltips rely on the 3rd party library [Popper.js](https://popper.js.org/) for positioning. You must include [popper.min.js]({{< param "cdn.popper" >}}) before bootstrap.js or use `bootstrap.bundle.min.js` / `bootstrap.bundle.js` which contains Popper.js in order for tooltips to work!
- If you're building our JavaScript from source, it [requires `util.js`]({{< docsref "/getting-started/javascript#util" >}}).
- Tooltips are opt-in for performance reasons, so **you must initialize them yourself**.
- Tooltips with zero-length titles are never displayed.
- Specify `container: 'body'` to avoid rendering problems in more complex components (like our input groups, button groups, etc).
Expand All @@ -32,8 +31,9 @@ Got all that? Great, let's see how they work with some examples.
One way to initialize all tooltips on a page would be to select them by their `data-toggle` attribute:

{{< highlight js >}}
$(function () {
$('[data-toggle="tooltip"]').tooltip()
var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-toggle="tooltip"]'))
var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
return new bootstrap.Tooltip(tooltipTriggerEl)
})
{{< /highlight >}}

Expand Down Expand Up @@ -88,7 +88,8 @@ The tooltip plugin generates content and markup on demand, and by default places
Trigger the tooltip via JavaScript:

{{< highlight js >}}
$('#example').tooltip(options)
var exampleEl = document.getElementById('example')
var tooltip = new bootstrap.Tooltip(exampleEl, options)
{{< /highlight >}}

{{< callout warning >}}
Expand All @@ -97,7 +98,10 @@ $('#example').tooltip(options)
Tooltip position attempts to automatically change when a parent container has `overflow: auto` or `overflow: scroll` like our `.table-responsive`, but still keeps the original placement's positioning. To resolve, set the `boundary` option to anything other than default value, `'scrollParent'`, such as `'window'`:

{{< highlight js >}}
$('#example').tooltip({ boundary: 'window' })
var exampleEl = document.getElementById('example')
var tooltip = new bootstrap.Tooltip(exampleEl, {
boundary: 'window'
})
{{< /highlight >}}
{{< /callout >}}

Expand Down Expand Up @@ -291,57 +295,53 @@ Options for individual tooltips can alternatively be specified through the use o
{{< partial "callout-danger-async-methods.md" >}}
{{< /callout >}}

#### `$().tooltip(options)`

Attaches a tooltip handler to an element collection.

#### `.tooltip('show')`
#### show

Reveals an element's tooltip. **Returns to the caller before the tooltip has actually been shown** (i.e. before the `shown.bs.tooltip` event occurs). This is considered a "manual" triggering of the tooltip. Tooltips with zero-length titles are never displayed.

{{< highlight js >}}$('#element').tooltip('show'){{< /highlight >}}
{{< highlight js >}}tooltip.show(){{< /highlight >}}

#### `.tooltip('hide')`
#### hide

Hides an element's tooltip. **Returns to the caller before the tooltip has actually been hidden** (i.e. before the `hidden.bs.tooltip` event occurs). This is considered a "manual" triggering of the tooltip.

{{< highlight js >}}$('#element').tooltip('hide'){{< /highlight >}}
{{< highlight js >}}tooltip.hide(){{< /highlight >}}

#### `.tooltip('toggle')`
#### toggle

Toggles an element's tooltip. **Returns to the caller before the tooltip has actually been shown or hidden** (i.e. before the `shown.bs.tooltip` or `hidden.bs.tooltip` event occurs). This is considered a "manual" triggering of the tooltip.

{{< highlight js >}}$('#element').tooltip('toggle'){{< /highlight >}}
{{< highlight js >}}tooltip.toggle(){{< /highlight >}}

#### `.tooltip('dispose')`
#### dispose

Hides and destroys an element's tooltip. Tooltips that use delegation (which are created using [the `selector` option](#options)) cannot be individually destroyed on descendant trigger elements.

{{< highlight js >}}$('#element').tooltip('dispose'){{< /highlight >}}
{{< highlight js >}}tooltip.dispose(){{< /highlight >}}

#### `.tooltip('enable')`
#### enable

Gives an element's tooltip the ability to be shown. **Tooltips are enabled by default.**

{{< highlight js >}}$('#element').tooltip('enable'){{< /highlight >}}
{{< highlight js >}}tooltip.enable(){{< /highlight >}}

#### `.tooltip('disable')`
#### disable

Removes the ability for an element's tooltip to be shown. The tooltip will only be able to be shown if it is re-enabled.

{{< highlight js >}}$('#element').tooltip('disable'){{< /highlight >}}
{{< highlight js >}}tooltip.disable(){{< /highlight >}}

#### `.tooltip('toggleEnabled')`
#### toggleEnabled

Toggles the ability for an element's tooltip to be shown or hidden.

{{< highlight js >}}$('#element').tooltip('toggleEnabled'){{< /highlight >}}
{{< highlight js >}}tooltip.toggleEnabled(){{< /highlight >}}

#### `.tooltip('update')`
#### update

Updates the position of an element's tooltip.

{{< highlight js >}}$('#element').tooltip('update'){{< /highlight >}}
{{< highlight js >}}tooltip.update(){{< /highlight >}}

### Events

Expand Down Expand Up @@ -377,7 +377,12 @@ Updates the position of an element's tooltip.
</table>

{{< highlight js >}}
$('#myTooltip').on('hidden.bs.tooltip', function () {
var myTooltipEl = document.getElementById('myTooltip')
var tooltip = new bootstrap.Tooltip(myTooltipEl)

myTooltipEl.addEventListener('hidden.bs.tooltip', function () {
// do something...
})

tooltip.hide()
{{< /highlight >}}
22 changes: 0 additions & 22 deletions site/content/docs/4.3/getting-started/browsers-devices.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,28 +129,6 @@ The `.dropdown-backdrop` element isn't used on iOS in the nav because of the com

Page zooming inevitably presents rendering artifacts in some components, both in Bootstrap and the rest of the web. Depending on the issue, we may be able to fix it (search first and then open an issue if need be). However, we tend to ignore these as they often have no direct solution other than hacky workarounds.

## Android stock browser

Out of the box, Android 4.1 (and even some newer releases apparently) ship with the Browser app as the default web browser of choice (as opposed to Chrome). Unfortunately, the Browser app has lots of bugs and inconsistencies with CSS in general.

#### Select menu

On `<select>` elements, the Android stock browser will not display the side controls if there is a `border-radius` and/or `border` applied. (See [this StackOverflow question](https://stackoverflow.com/questions/14744437/html-select-box-not-showing-drop-down-arrow-on-android-version-4-0-when-set-with) for details.) Use the snippet of code below to remove the offending CSS and render the `<select>` as an unstyled element on the Android stock browser. The user agent sniffing avoids interference with Chrome, Safari, and Mozilla browsers.

{{< highlight html >}}
<script>
$(function () {
var nua = navigator.userAgent
var isAndroid = (nua.indexOf('Mozilla/5.0') > -1 && nua.indexOf('Android ') > -1 && nua.indexOf('AppleWebKit') > -1 && nua.indexOf('Chrome') === -1)
if (isAndroid) {
$('select.form-control').removeClass('form-control').css('width', '100%')
}
})
</script>
{{< /highlight >}}

Want to see an example? [Check out this JS Bin demo](http://jsbin.com/OyaqoDO/2).

## Validators

In order to provide the best possible experience to old and buggy browsers, Bootstrap uses [CSS browser hacks](http://browserhacks.com/) in several places to target special CSS to certain browser versions in order to work around bugs in the browsers themselves. These hacks understandably cause CSS validators to complain that they are invalid. In a couple places, we also use bleeding-edge CSS features that aren't yet fully standardized, but these are used purely for progressive enhancement.
Expand Down