Skip to content

Commit 9d129a4

Browse files
committed
Use a single class name for opened/expanded/shown state of widgets
1 parent f11f630 commit 9d129a4

File tree

19 files changed

+113
-113
lines changed

19 files changed

+113
-113
lines changed

docs/components/alerts.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,12 @@ Using the alert JavaScript plugin, it's possible to dismiss any alert inline. He
7373
- Be sure you've loaded the alert plugin, or the compiled Bootstrap JavaScript.
7474
- Add a dismiss button and the `.alert-dismissible` class, which adds extra padding to the right of the alert and positions the `.close` button.
7575
- 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.
76-
- To animate alerts when dismissing them, be sure to add the `.fade` and `.in` classes.
76+
- To animate alerts when dismissing them, be sure to add the `.fade` and `.active` classes.
7777

7878
You can see this in action with a live demo:
7979

8080
{% example html %}
81-
<div class="alert alert-warning alert-dismissible fade in" role="alert">
81+
<div class="alert alert-warning alert-dismissible fade active" role="alert">
8282
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
8383
<span aria-hidden="true">&times;</span>
8484
</button>

docs/components/collapse.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Click the buttons below to show and hide another element via class changes:
1818

1919
- `.collapse` hides content
2020
- `.collapsing` is applied during transitions
21-
- `.collapse.in` shows content
21+
- `.collapse.active` shows content
2222

2323
You can use a link with the `href` attribute, or a button with the `data-target` attribute. In both cases, the `data-toggle="collapse"` is required.
2424

@@ -53,7 +53,7 @@ Extend the default collapse behavior to create an accordion.
5353
</h5>
5454
</div>
5555

56-
<div id="collapseOne" class="collapse in" role="tabpanel" aria-labelledby="headingOne">
56+
<div id="collapseOne" class="collapse active" role="tabpanel" aria-labelledby="headingOne">
5757
<div class="card-block">
5858
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
5959
</div>
@@ -101,14 +101,14 @@ Additionally, if your control element is targeting a single collapsible element
101101
The collapse plugin utilizes a few classes to handle the heavy lifting:
102102

103103
- `.collapse` hides the content
104-
- `.collapse.in` shows the content
104+
- `.collapse.active` shows the content
105105
- `.collapsing` is added when the transition starts, and removed when it finishes
106106

107107
These classes can be found in `_animation.scss`.
108108

109109
### Via data attributes
110110

111-
Just add `data-toggle="collapse"` and a `data-target` to the element to automatically assign control of a collapsible element. The `data-target` attribute accepts a CSS selector to apply the collapse to. Be sure to add the class `collapse` to the collapsible element. If you'd like it to default open, add the additional class `in`.
111+
Just add `data-toggle="collapse"` and a `data-target` to the element to automatically assign control of a collapsible element. The `data-target` attribute accepts a CSS selector to apply the collapse to. Be sure to add the class `collapse` to the collapsible element. If you'd like it to default open, add the additional class `active`.
112112

113113
To add accordion-like group management to a collapsible control, add the data attribute `data-parent="#selector"`. Refer to the demo to see this in action.
114114

docs/components/dropdowns.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Wrap the dropdown's toggle (your button or link) and the dropdown menu within `.
2121
Any single `.btn` can be turned into a dropdown toggle with some markup changes. Here's how you can put them to work with either `<button>` elements:
2222

2323
{% example html %}
24-
<div class="dropdown open">
24+
<div class="dropdown active">
2525
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
2626
Dropdown button
2727
</button>
@@ -36,7 +36,7 @@ Any single `.btn` can be turned into a dropdown toggle with some markup changes.
3636
And with `<a>` elements:
3737

3838
{% example html %}
39-
<div class="dropdown open">
39+
<div class="dropdown active">
4040
<a class="btn btn-secondary dropdown-toggle" href="https://example.com" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
4141
Dropdown link
4242
</a>
@@ -407,7 +407,7 @@ Trigger dropdown menus above elements by adding `.dropup` to the parent element.
407407
Historically dropdown menu contents *had* to be links, but that's no longer the case with v4. Now you can optionally use `<button>` elements in your dropdowns instead of just `<a>`s.
408408

409409
{% example html %}
410-
<div class="dropdown open">
410+
<div class="dropdown active">
411411
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenu2" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
412412
Dropdown
413413
</button>
@@ -480,7 +480,7 @@ Add `.disabled` to items in the dropdown to **style them as disabled**.
480480

481481
## Usage
482482

483-
Via data attributes or JavaScript, the dropdown plugin toggles hidden content (dropdown menus) by toggling the `.open` class on the parent list item.
483+
Via data attributes or JavaScript, the dropdown plugin toggles hidden content (dropdown menus) by toggling the `.active` class on the parent list item.
484484

485485
On mobile devices, opening a dropdown adds a `.dropdown-backdrop` as a tap area for closing dropdown menus when tapping outside the menu, a requirement for proper iOS support. **This means that switching from an open dropdown menu to a different dropdown menu requires an extra tap on mobile.**
486486

js/src/alert.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ const Alert = (($) => {
3636
}
3737

3838
const ClassName = {
39-
ALERT : 'alert',
40-
FADE : 'fade',
41-
IN : 'in'
39+
ALERT : 'alert',
40+
FADE : 'fade',
41+
ACTIVE : 'active'
4242
}
4343

4444

@@ -108,7 +108,7 @@ const Alert = (($) => {
108108
}
109109

110110
_removeElement(element) {
111-
$(element).removeClass(ClassName.IN)
111+
$(element).removeClass(ClassName.ACTIVE)
112112

113113
if (!Util.supportsTransitionEnd() ||
114114
!$(element).hasClass(ClassName.FADE)) {

js/src/collapse.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const Collapse = (($) => {
4444
}
4545

4646
const ClassName = {
47-
IN : 'in',
47+
ACTIVE : 'active',
4848
COLLAPSE : 'collapse',
4949
COLLAPSING : 'collapsing',
5050
COLLAPSED : 'collapsed'
@@ -56,7 +56,7 @@ const Collapse = (($) => {
5656
}
5757

5858
const Selector = {
59-
ACTIVES : '.card > .in, .card > .collapsing',
59+
ACTIVES : '.card > .active, .card > .collapsing',
6060
DATA_TOGGLE : '[data-toggle="collapse"]'
6161
}
6262

@@ -104,7 +104,7 @@ const Collapse = (($) => {
104104
// public
105105

106106
toggle() {
107-
if ($(this._element).hasClass(ClassName.IN)) {
107+
if ($(this._element).hasClass(ClassName.ACTIVE)) {
108108
this.hide()
109109
} else {
110110
this.show()
@@ -113,7 +113,7 @@ const Collapse = (($) => {
113113

114114
show() {
115115
if (this._isTransitioning ||
116-
$(this._element).hasClass(ClassName.IN)) {
116+
$(this._element).hasClass(ClassName.ACTIVE)) {
117117
return
118118
}
119119

@@ -168,7 +168,7 @@ const Collapse = (($) => {
168168
$(this._element)
169169
.removeClass(ClassName.COLLAPSING)
170170
.addClass(ClassName.COLLAPSE)
171-
.addClass(ClassName.IN)
171+
.addClass(ClassName.ACTIVE)
172172

173173
this._element.style[dimension] = ''
174174

@@ -194,7 +194,7 @@ const Collapse = (($) => {
194194

195195
hide() {
196196
if (this._isTransitioning ||
197-
!$(this._element).hasClass(ClassName.IN)) {
197+
!$(this._element).hasClass(ClassName.ACTIVE)) {
198198
return
199199
}
200200

@@ -215,7 +215,7 @@ const Collapse = (($) => {
215215
$(this._element)
216216
.addClass(ClassName.COLLAPSING)
217217
.removeClass(ClassName.COLLAPSE)
218-
.removeClass(ClassName.IN)
218+
.removeClass(ClassName.ACTIVE)
219219

220220
this._element.setAttribute('aria-expanded', false)
221221

@@ -293,7 +293,7 @@ const Collapse = (($) => {
293293

294294
_addAriaAndCollapsedClass(element, triggerArray) {
295295
if (element) {
296-
let isOpen = $(element).hasClass(ClassName.IN)
296+
let isOpen = $(element).hasClass(ClassName.ACTIVE)
297297
element.setAttribute('aria-expanded', isOpen)
298298

299299
if (triggerArray.length) {

js/src/dropdown.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const Dropdown = (($) => {
4141
const ClassName = {
4242
BACKDROP : 'dropdown-backdrop',
4343
DISABLED : 'disabled',
44-
OPEN : 'open'
44+
ACTIVE : 'active'
4545
}
4646

4747
const Selector = {
@@ -86,7 +86,7 @@ const Dropdown = (($) => {
8686
}
8787

8888
let parent = Dropdown._getParentFromElement(this)
89-
let isActive = $(parent).hasClass(ClassName.OPEN)
89+
let isActive = $(parent).hasClass(ClassName.ACTIVE)
9090

9191
Dropdown._clearMenus()
9292

@@ -116,7 +116,7 @@ const Dropdown = (($) => {
116116
this.focus()
117117
this.setAttribute('aria-expanded', 'true')
118118

119-
$(parent).toggleClass(ClassName.OPEN)
119+
$(parent).toggleClass(ClassName.ACTIVE)
120120
$(parent).trigger($.Event(Event.SHOWN, relatedTarget))
121121

122122
return false
@@ -171,7 +171,7 @@ const Dropdown = (($) => {
171171
let parent = Dropdown._getParentFromElement(toggles[i])
172172
let relatedTarget = { relatedTarget : toggles[i] }
173173

174-
if (!$(parent).hasClass(ClassName.OPEN)) {
174+
if (!$(parent).hasClass(ClassName.ACTIVE)) {
175175
continue
176176
}
177177

@@ -190,7 +190,7 @@ const Dropdown = (($) => {
190190
toggles[i].setAttribute('aria-expanded', 'false')
191191

192192
$(parent)
193-
.removeClass(ClassName.OPEN)
193+
.removeClass(ClassName.ACTIVE)
194194
.trigger($.Event(Event.HIDDEN, relatedTarget))
195195
}
196196
}
@@ -220,7 +220,7 @@ const Dropdown = (($) => {
220220
}
221221

222222
let parent = Dropdown._getParentFromElement(this)
223-
let isActive = $(parent).hasClass(ClassName.OPEN)
223+
let isActive = $(parent).hasClass(ClassName.ACTIVE)
224224

225225
if ((!isActive && event.which !== ESCAPE_KEYCODE) ||
226226
(isActive && event.which === ESCAPE_KEYCODE)) {

js/src/modal.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ const Modal = (($) => {
6060
BACKDROP : 'modal-backdrop',
6161
OPEN : 'modal-open',
6262
FADE : 'fade',
63-
IN : 'in'
63+
ACTIVE : 'active'
6464
}
6565

6666
const Selector = {
@@ -169,7 +169,7 @@ const Modal = (($) => {
169169

170170
$(document).off(Event.FOCUSIN)
171171

172-
$(this._element).removeClass(ClassName.IN)
172+
$(this._element).removeClass(ClassName.ACTIVE)
173173

174174
$(this._element).off(Event.CLICK_DISMISS)
175175
$(this._dialog).off(Event.MOUSEDOWN_DISMISS)
@@ -231,7 +231,7 @@ const Modal = (($) => {
231231
Util.reflow(this._element)
232232
}
233233

234-
$(this._element).addClass(ClassName.IN)
234+
$(this._element).addClass(ClassName.ACTIVE)
235235

236236
if (this._config.focus) {
237237
this._enforceFocus()
@@ -343,7 +343,7 @@ const Modal = (($) => {
343343
Util.reflow(this._backdrop)
344344
}
345345

346-
$(this._backdrop).addClass(ClassName.IN)
346+
$(this._backdrop).addClass(ClassName.ACTIVE)
347347

348348
if (!callback) {
349349
return
@@ -359,7 +359,7 @@ const Modal = (($) => {
359359
.emulateTransitionEnd(BACKDROP_TRANSITION_DURATION)
360360

361361
} else if (!this._isShown && this._backdrop) {
362-
$(this._backdrop).removeClass(ClassName.IN)
362+
$(this._backdrop).removeClass(ClassName.ACTIVE)
363363

364364
let callbackRemove = () => {
365365
this._removeBackdrop()

js/src/popover.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ const Popover = (($) => {
3737
})
3838

3939
const ClassName = {
40-
FADE : 'fade',
41-
IN : 'in'
40+
FADE : 'fade',
41+
ACTIVE : 'active'
4242
}
4343

4444
const Selector = {
@@ -119,7 +119,7 @@ const Popover = (($) => {
119119

120120
$tip
121121
.removeClass(ClassName.FADE)
122-
.removeClass(ClassName.IN)
122+
.removeClass(ClassName.ACTIVE)
123123

124124
this.cleanupTether()
125125
}

js/src/tooltip.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ const Tooltip = (($) => {
7070
}
7171

7272
const HoverState = {
73-
IN : 'in',
74-
OUT : 'out'
73+
ACTIVE : 'active',
74+
OUT : 'out'
7575
}
7676

7777
const Event = {
@@ -88,8 +88,8 @@ const Tooltip = (($) => {
8888
}
8989

9090
const ClassName = {
91-
FADE : 'fade',
92-
IN : 'in'
91+
FADE : 'fade',
92+
ACTIVE : 'active'
9393
}
9494

9595
const Selector = {
@@ -205,7 +205,7 @@ const Tooltip = (($) => {
205205

206206
} else {
207207

208-
if ($(this.getTipElement()).hasClass(ClassName.IN)) {
208+
if ($(this.getTipElement()).hasClass(ClassName.ACTIVE)) {
209209
this._leave(null, this)
210210
return
211211
}
@@ -291,7 +291,7 @@ const Tooltip = (($) => {
291291
Util.reflow(tip)
292292
this._tether.position()
293293

294-
$(tip).addClass(ClassName.IN)
294+
$(tip).addClass(ClassName.ACTIVE)
295295

296296
let complete = () => {
297297
let prevHoverState = this._hoverState
@@ -319,7 +319,7 @@ const Tooltip = (($) => {
319319
let tip = this.getTipElement()
320320
let hideEvent = $.Event(this.constructor.Event.HIDE)
321321
let complete = () => {
322-
if (this._hoverState !== HoverState.IN && tip.parentNode) {
322+
if (this._hoverState !== HoverState.ACTIVE && tip.parentNode) {
323323
tip.parentNode.removeChild(tip)
324324
}
325325

@@ -338,7 +338,7 @@ const Tooltip = (($) => {
338338
return
339339
}
340340

341-
$(tip).removeClass(ClassName.IN)
341+
$(tip).removeClass(ClassName.ACTIVE)
342342

343343
if (Util.supportsTransitionEnd() &&
344344
($(this.tip).hasClass(ClassName.FADE))) {
@@ -372,7 +372,7 @@ const Tooltip = (($) => {
372372

373373
$tip
374374
.removeClass(ClassName.FADE)
375-
.removeClass(ClassName.IN)
375+
.removeClass(ClassName.ACTIVE)
376376

377377
this.cleanupTether()
378378
}
@@ -492,23 +492,23 @@ const Tooltip = (($) => {
492492
] = true
493493
}
494494

495-
if ($(context.getTipElement()).hasClass(ClassName.IN) ||
496-
(context._hoverState === HoverState.IN)) {
497-
context._hoverState = HoverState.IN
495+
if ($(context.getTipElement()).hasClass(ClassName.ACTIVE) ||
496+
(context._hoverState === HoverState.ACTIVE)) {
497+
context._hoverState = HoverState.ACTIVE
498498
return
499499
}
500500

501501
clearTimeout(context._timeout)
502502

503-
context._hoverState = HoverState.IN
503+
context._hoverState = HoverState.ACTIVE
504504

505505
if (!context.config.delay || !context.config.delay.show) {
506506
context.show()
507507
return
508508
}
509509

510510
context._timeout = setTimeout(() => {
511-
if (context._hoverState === HoverState.IN) {
511+
if (context._hoverState === HoverState.ACTIVE) {
512512
context.show()
513513
}
514514
}, context.config.delay.show)

0 commit comments

Comments
 (0)