Skip to content

Commit 81a50bc

Browse files
committed
refactor: minor bug fixes and improvements
1 parent a71ca1f commit 81a50bc

28 files changed

+179
-174
lines changed

js/src/alert.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
/**
22
* --------------------------------------------------------------------------
3-
* CoreUI (v4.2.6): alert.js
4-
* Licensed under MIT (https://coreui.io/license)
3+
* CoreUI alert.js
4+
* Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
55
*
66
* This component is a modified version of the Bootstrap's alert.js
77
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
88
* --------------------------------------------------------------------------
99
*/
1010

11-
import { defineJQueryPlugin } from './util/index.js'
12-
import EventHandler from './dom/event-handler.js'
1311
import BaseComponent from './base-component.js'
12+
import EventHandler from './dom/event-handler.js'
1413
import { enableDismissTrigger } from './util/component-functions.js'
14+
import { defineJQueryPlugin } from './util/index.js'
1515

1616
/**
1717
* Constants

js/src/base-component.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
/**
22
* --------------------------------------------------------------------------
3-
* CoreUI (v4.2.6): alert.js
4-
* Licensed under MIT (https://coreui.io/license)
3+
* CoreUI base-component.js
4+
* Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
55
*
66
* This component is a modified version of the Bootstrap's base-component.js
77
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
88
* --------------------------------------------------------------------------
99
*/
1010

1111
import Data from './dom/data.js'
12-
import { executeAfterTransition, getElement } from './util/index.js'
1312
import EventHandler from './dom/event-handler.js'
1413
import Config from './util/config.js'
14+
import { executeAfterTransition, getElement } from './util/index.js'
1515

1616
/**
1717
* Constants
1818
*/
1919

20-
const VERSION = '4.2.6'
20+
const VERSION = '5.0.0-alpha.1'
2121

2222
/**
2323
* Class definition

js/src/button.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
/**
22
* --------------------------------------------------------------------------
3-
* CoreUI (v4.2.6): alert.js
4-
* Licensed under MIT (https://coreui.io/license)
3+
* CoreUI button.js
4+
* Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
55
*
66
* This component is a modified version of the Bootstrap's button.js
77
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
88
* --------------------------------------------------------------------------
99
*/
1010

11-
import { defineJQueryPlugin } from './util/index.js'
12-
import EventHandler from './dom/event-handler.js'
1311
import BaseComponent from './base-component.js'
12+
import EventHandler from './dom/event-handler.js'
13+
import { defineJQueryPlugin } from './util/index.js'
1414

1515
/**
1616
* Constants

js/src/carousel.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
/**
22
* --------------------------------------------------------------------------
3-
* CoreUI (v4.2.6): carousel.js
4-
* Licensed under MIT (https://coreui.io/license)
3+
* CoreUI carousel.js
4+
* Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
55
*
66
* This component is a modified version of the Bootstrap's carousel.js
77
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
88
* --------------------------------------------------------------------------
99
*/
1010

11+
import BaseComponent from './base-component.js'
12+
import EventHandler from './dom/event-handler.js'
13+
import Manipulator from './dom/manipulator.js'
14+
import SelectorEngine from './dom/selector-engine.js'
1115
import {
1216
defineJQueryPlugin,
1317
getNextActiveElement,
@@ -16,11 +20,7 @@ import {
1620
reflow,
1721
triggerTransitionEnd
1822
} from './util/index.js'
19-
import EventHandler from './dom/event-handler.js'
20-
import Manipulator from './dom/manipulator.js'
21-
import SelectorEngine from './dom/selector-engine.js'
2223
import Swipe from './util/swipe.js'
23-
import BaseComponent from './base-component.js'
2424

2525
/**
2626
* Constants
@@ -332,7 +332,7 @@ class Carousel extends BaseComponent {
332332

333333
if (!activeElement || !nextElement) {
334334
// Some weirdness is happening, so we bail
335-
// todo: change tests that use empty divs to avoid this check
335+
// TODO: change tests that use empty divs to avoid this check
336336
return
337337
}
338338

js/src/collapse.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
/**
22
* --------------------------------------------------------------------------
3-
* CoreUI (v4.2.6): collapse.js
4-
* Licensed under MIT (https://coreui.io/license)
3+
* CoreUI collapse.js
4+
* Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
55
*
66
* This component is a modified version of the Bootstrap's collapse.js
77
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
88
* --------------------------------------------------------------------------
99
*/
1010

11+
import BaseComponent from './base-component.js'
12+
import EventHandler from './dom/event-handler.js'
13+
import SelectorEngine from './dom/selector-engine.js'
1114
import {
1215
defineJQueryPlugin,
1316
getElement,
1417
reflow
1518
} from './util/index.js'
16-
import EventHandler from './dom/event-handler.js'
17-
import SelectorEngine from './dom/selector-engine.js'
18-
import BaseComponent from './base-component.js'
1919

2020
/**
2121
* Constants

js/src/dom/data.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* --------------------------------------------------------------------------
3-
* CoreUI (v4.2.6): dom/selector-engine.js
4-
* Licensed under MIT (https://coreui.io/license)
3+
* CoreUI dom/data.js
4+
* Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
55
*
66
* This is a modified version of the Bootstrap's dom/data.js
77
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)

js/src/dom/event-handler.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* --------------------------------------------------------------------------
3-
* CoreUI (v4.2.6): dom/selector-engine.js
4-
* Licensed under MIT (https://coreui.io/license)
3+
* CoreUI dom/event-handler.js
4+
* Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
55
*
66
* This is a modified version of the Bootstrap's dom/event-handler.js
77
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
@@ -131,7 +131,7 @@ function findHandler(events, callable, delegationSelector = null) {
131131

132132
function normalizeParameters(originalTypeEvent, handler, delegationFunction) {
133133
const isDelegated = typeof handler === 'string'
134-
// todo: tooltip passes `false` instead of selector, so we need to check
134+
// TODO: tooltip passes `false` instead of selector, so we need to check
135135
const callable = isDelegated ? delegationFunction : (handler || delegationFunction)
136136
let typeEvent = getTypeEvent(originalTypeEvent)
137137

@@ -282,8 +282,7 @@ const EventHandler = {
282282
defaultPrevented = jQueryEvent.isDefaultPrevented()
283283
}
284284

285-
let evt = new Event(event, { bubbles, cancelable: true })
286-
evt = hydrateObj(evt, args)
285+
const evt = hydrateObj(new Event(event, { bubbles, cancelable: true }), args)
287286

288287
if (defaultPrevented) {
289288
evt.preventDefault()

js/src/dom/manipulator.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* --------------------------------------------------------------------------
3-
* CoreUI (v4.2.6): dom/selector-engine.js
4-
* Licensed under MIT (https://coreui.io/license)
3+
* CoreUI dom/manipulator.js
4+
* Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
55
*
66
* This is a modified version of the Bootstrap's dom/manipulator.js
77
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)

js/src/dom/selector-engine.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* --------------------------------------------------------------------------
3-
* CoreUI (v4.2.6): dom/selector-engine.js
4-
* Licensed under MIT (https://coreui.io/license)
3+
* CoreUI dom/selector-engine.js
4+
* Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
55
*
66
* This is a modified version of the Bootstrap's dom/selector-engine.js
77
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)

js/src/dropdown.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
/**
22
* --------------------------------------------------------------------------
3-
* CoreUI (v4.2.6): dropdown.js
4-
* Licensed under MIT (https://coreui.io/license)
3+
* CoreUI dropdown.js
4+
* Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
55
*
66
* This component is a modified version of the Bootstrap's dropdown.js
77
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
88
* --------------------------------------------------------------------------
99
*/
1010

1111
import * as Popper from '@popperjs/core'
12+
import BaseComponent from './base-component.js'
13+
import EventHandler from './dom/event-handler.js'
14+
import Manipulator from './dom/manipulator.js'
15+
import SelectorEngine from './dom/selector-engine.js'
1216
import {
1317
defineJQueryPlugin,
1418
execute,
@@ -20,10 +24,6 @@ import {
2024
isVisible,
2125
noop
2226
} from './util/index.js'
23-
import EventHandler from './dom/event-handler.js'
24-
import Manipulator from './dom/manipulator.js'
25-
import SelectorEngine from './dom/selector-engine.js'
26-
import BaseComponent from './base-component.js'
2727

2828
/**
2929
* Constants
@@ -99,7 +99,7 @@ class Dropdown extends BaseComponent {
9999

100100
this._popper = null
101101
this._parent = this._element.parentNode // dropdown wrapper
102-
// todo: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.2/forms/input-group/
102+
// TODO: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.3/forms/input-group/
103103
this._menu = SelectorEngine.next(this._element, SELECTOR_MENU)[0] ||
104104
SelectorEngine.prev(this._element, SELECTOR_MENU)[0] ||
105105
SelectorEngine.findOne(SELECTOR_MENU, this._parent)
@@ -314,7 +314,7 @@ class Dropdown extends BaseComponent {
314314

315315
// Disable Popper if we have a static display or Dropdown is in Navbar
316316
if (this._inNavbar || this._config.display === 'static') {
317-
Manipulator.setDataAttribute(this._menu, 'popper', 'static') // todo:v6 remove
317+
Manipulator.setDataAttribute(this._menu, 'popper', 'static') // TODO: v6 remove
318318
defaultBsPopperConfig.modifiers = [{
319319
name: 'applyStyles',
320320
enabled: false
@@ -412,7 +412,7 @@ class Dropdown extends BaseComponent {
412412

413413
event.preventDefault()
414414

415-
// todo: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.2/forms/input-group/
415+
// TODO: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.3/forms/input-group/
416416
const getToggleButton = this.matches(SELECTOR_DATA_TOGGLE) ?
417417
this :
418418
(SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE)[0] ||

0 commit comments

Comments
 (0)