diff --git a/js/src/alert/alert.js b/js/src/alert/alert.js
index 328aa16ae6..793b5989af 100644
--- a/js/src/alert/alert.js
+++ b/js/src/alert/alert.js
@@ -128,7 +128,7 @@ class Alert {
// Static
- static _jQueryInterface(config) {
+ static jQueryInterface(config) {
return this.each(function () {
let data = Data.getData(this, DATA_KEY)
@@ -142,7 +142,7 @@ class Alert {
})
}
- static _handleDismiss(alertInstance) {
+ static handleDismiss(alertInstance) {
return function (event) {
if (event) {
event.preventDefault()
@@ -152,7 +152,7 @@ class Alert {
}
}
- static _getInstance(element) {
+ static getInstance(element) {
return Data.getData(element, DATA_KEY)
}
}
@@ -163,7 +163,7 @@ class Alert {
* ------------------------------------------------------------------------
*/
EventHandler
- .on(document, Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()))
+ .on(document, Event.CLICK_DATA_API, Selector.DISMISS, Alert.handleDismiss(new Alert()))
/**
* ------------------------------------------------------------------------
@@ -175,11 +175,11 @@ EventHandler
/* istanbul ignore if */
if (typeof $ !== 'undefined') {
const JQUERY_NO_CONFLICT = $.fn[NAME]
- $.fn[NAME] = Alert._jQueryInterface
+ $.fn[NAME] = Alert.jQueryInterface
$.fn[NAME].Constructor = Alert
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT
- return Alert._jQueryInterface
+ return Alert.jQueryInterface
}
}
diff --git a/js/src/alert/alert.spec.js b/js/src/alert/alert.spec.js
index 5cf314d222..05e3dbd686 100644
--- a/js/src/alert/alert.spec.js
+++ b/js/src/alert/alert.spec.js
@@ -117,15 +117,15 @@ describe('Alert', () => {
const alertEl = document.querySelector('.alert')
const alert = new Alert(alertEl)
- expect(Alert._getInstance(alertEl)).toBeDefined()
+ expect(Alert.getInstance(alertEl)).toBeDefined()
alert.dispose()
- expect(Alert._getInstance(alertEl)).toBeNull()
+ expect(Alert.getInstance(alertEl)).toBeNull()
})
})
- describe('_jQueryInterface', () => {
+ describe('jQueryInterface', () => {
it('should handle config passed and toggle existing alert', () => {
fixtureEl.innerHTML = '
'
@@ -134,7 +134,7 @@ describe('Alert', () => {
spyOn(alert, 'close')
- jQueryMock.fn.alert = Alert._jQueryInterface
+ jQueryMock.fn.alert = Alert.jQueryInterface
jQueryMock.elements = [alertEl]
jQueryMock.fn.alert.call(jQueryMock, 'close')
@@ -147,12 +147,12 @@ describe('Alert', () => {
const alertEl = fixtureEl.querySelector('.alert')
- jQueryMock.fn.alert = Alert._jQueryInterface
+ jQueryMock.fn.alert = Alert.jQueryInterface
jQueryMock.elements = [alertEl]
jQueryMock.fn.alert.call(jQueryMock, 'close')
- expect(Alert._getInstance(alertEl)).toBeDefined()
+ expect(Alert.getInstance(alertEl)).toBeDefined()
expect(fixtureEl.querySelector('.alert')).toBeNull()
})
@@ -161,12 +161,12 @@ describe('Alert', () => {
const alertEl = fixtureEl.querySelector('.alert')
- jQueryMock.fn.alert = Alert._jQueryInterface
+ jQueryMock.fn.alert = Alert.jQueryInterface
jQueryMock.elements = [alertEl]
jQueryMock.fn.alert.call(jQueryMock)
- expect(Alert._getInstance(alertEl)).toBeDefined()
+ expect(Alert.getInstance(alertEl)).toBeDefined()
expect(fixtureEl.querySelector('.alert')).not.toBeNull()
})
})
diff --git a/js/src/button/button.js b/js/src/button/button.js
index 2e6033b64e..b7e20461d6 100644
--- a/js/src/button/button.js
+++ b/js/src/button/button.js
@@ -122,7 +122,7 @@ class Button {
// Static
- static _jQueryInterface(config) {
+ static jQueryInterface(config) {
return this.each(function () {
let data = Data.getData(this, DATA_KEY)
@@ -136,7 +136,7 @@ class Button {
})
}
- static _getInstance(element) {
+ static getInstance(element) {
return Data.getData(element, DATA_KEY)
}
}
@@ -188,12 +188,12 @@ EventHandler.on(document, Event.BLUR_DATA_API, Selector.DATA_TOGGLE_CARROT, even
/* istanbul ignore if */
if (typeof $ !== 'undefined') {
const JQUERY_NO_CONFLICT = $.fn[NAME]
- $.fn[NAME] = Button._jQueryInterface
+ $.fn[NAME] = Button.jQueryInterface
$.fn[NAME].Constructor = Button
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT
- return Button._jQueryInterface
+ return Button.jQueryInterface
}
}
diff --git a/js/src/button/button.spec.js b/js/src/button/button.spec.js
index 7114088964..6228811854 100644
--- a/js/src/button/button.spec.js
+++ b/js/src/button/button.spec.js
@@ -236,15 +236,15 @@ describe('Button', () => {
const btnEl = fixtureEl.querySelector('.btn')
const button = new Button(btnEl)
- expect(Button._getInstance(btnEl)).toBeDefined()
+ expect(Button.getInstance(btnEl)).toBeDefined()
button.dispose()
- expect(Button._getInstance(btnEl)).toBeNull()
+ expect(Button.getInstance(btnEl)).toBeNull()
})
})
- describe('_jQueryInterface', () => {
+ describe('jQueryInterface', () => {
it('should handle config passed and toggle existing button', () => {
fixtureEl.innerHTML = ' '
@@ -253,7 +253,7 @@ describe('Button', () => {
spyOn(button, 'toggle')
- jQueryMock.fn.button = Button._jQueryInterface
+ jQueryMock.fn.button = Button.jQueryInterface
jQueryMock.elements = [btnEl]
jQueryMock.fn.button.call(jQueryMock, 'toggle')
@@ -266,12 +266,12 @@ describe('Button', () => {
const btnEl = fixtureEl.querySelector('.btn')
- jQueryMock.fn.button = Button._jQueryInterface
+ jQueryMock.fn.button = Button.jQueryInterface
jQueryMock.elements = [btnEl]
jQueryMock.fn.button.call(jQueryMock, 'toggle')
- expect(Button._getInstance(btnEl)).toBeDefined()
+ expect(Button.getInstance(btnEl)).toBeDefined()
expect(btnEl.classList.contains('active')).toEqual(true)
})
@@ -280,12 +280,12 @@ describe('Button', () => {
const btnEl = fixtureEl.querySelector('.btn')
- jQueryMock.fn.button = Button._jQueryInterface
+ jQueryMock.fn.button = Button.jQueryInterface
jQueryMock.elements = [btnEl]
jQueryMock.fn.button.call(jQueryMock)
- expect(Button._getInstance(btnEl)).toBeDefined()
+ expect(Button.getInstance(btnEl)).toBeDefined()
expect(btnEl.classList.contains('active')).toEqual(false)
})
})
diff --git a/js/src/carousel/carousel.js b/js/src/carousel/carousel.js
index af4229f07c..0bac655ea0 100644
--- a/js/src/carousel/carousel.js
+++ b/js/src/carousel/carousel.js
@@ -528,7 +528,7 @@ class Carousel {
// Static
- static _carouselInterface(element, config) {
+ static carouselInterface(element, config) {
let data = Data.getData(element, DATA_KEY)
let _config = {
...Default,
@@ -562,13 +562,13 @@ class Carousel {
}
}
- static _jQueryInterface(config) {
+ static jQueryInterface(config) {
return this.each(function () {
- Carousel._carouselInterface(this, config)
+ Carousel.carouselInterface(this, config)
})
}
- static _dataApiClickHandler(event) {
+ static dataApiClickHandler(event) {
const target = getElementFromSelector(this)
if (!target || !target.classList.contains(ClassName.CAROUSEL)) {
@@ -585,7 +585,7 @@ class Carousel {
config.interval = false
}
- Carousel._carouselInterface(target, config)
+ Carousel.carouselInterface(target, config)
if (slideIndex) {
Data.getData(target, DATA_KEY).to(slideIndex)
@@ -594,7 +594,7 @@ class Carousel {
event.preventDefault()
}
- static _getInstance(element) {
+ static getInstance(element) {
return Data.getData(element, DATA_KEY)
}
}
@@ -606,12 +606,12 @@ class Carousel {
*/
EventHandler
- .on(document, Event.CLICK_DATA_API, Selector.DATA_SLIDE, Carousel._dataApiClickHandler)
+ .on(document, Event.CLICK_DATA_API, Selector.DATA_SLIDE, Carousel.dataApiClickHandler)
EventHandler.on(window, Event.LOAD_DATA_API, () => {
const carousels = makeArray(SelectorEngine.find(Selector.DATA_RIDE))
for (let i = 0, len = carousels.length; i < len; i++) {
- Carousel._carouselInterface(carousels[i], Data.getData(carousels[i], DATA_KEY))
+ Carousel.carouselInterface(carousels[i], Data.getData(carousels[i], DATA_KEY))
}
})
@@ -624,11 +624,11 @@ EventHandler.on(window, Event.LOAD_DATA_API, () => {
/* istanbul ignore if */
if (typeof $ !== 'undefined') {
const JQUERY_NO_CONFLICT = $.fn[NAME]
- $.fn[NAME] = Carousel._jQueryInterface
+ $.fn[NAME] = Carousel.jQueryInterface
$.fn[NAME].Constructor = Carousel
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT
- return Carousel._jQueryInterface
+ return Carousel.jQueryInterface
}
}
diff --git a/js/src/carousel/carousel.spec.js b/js/src/carousel/carousel.spec.js
index 38888e7c2c..4c13b6d227 100644
--- a/js/src/carousel/carousel.spec.js
+++ b/js/src/carousel/carousel.spec.js
@@ -1037,18 +1037,18 @@ describe('Carousel', () => {
})
})
- describe('_jQueryInterface', () => {
+ describe('jQueryInterface', () => {
it('should create a carousel', () => {
fixtureEl.innerHTML = '
'
const div = fixtureEl.querySelector('div')
- jQueryMock.fn.carousel = Carousel._jQueryInterface
+ jQueryMock.fn.carousel = Carousel.jQueryInterface
jQueryMock.elements = [div]
jQueryMock.fn.carousel.call(jQueryMock)
- expect(Carousel._getInstance(div)).toBeDefined()
+ expect(Carousel.getInstance(div)).toBeDefined()
})
it('should not re create a carousel', () => {
@@ -1057,12 +1057,12 @@ describe('Carousel', () => {
const div = fixtureEl.querySelector('div')
const carousel = new Carousel(div)
- jQueryMock.fn.carousel = Carousel._jQueryInterface
+ jQueryMock.fn.carousel = Carousel.jQueryInterface
jQueryMock.elements = [div]
jQueryMock.fn.carousel.call(jQueryMock)
- expect(Carousel._getInstance(div)).toEqual(carousel)
+ expect(Carousel.getInstance(div)).toEqual(carousel)
})
it('should call to if the config is a number', () => {
@@ -1074,7 +1074,7 @@ describe('Carousel', () => {
spyOn(carousel, 'to')
- jQueryMock.fn.carousel = Carousel._jQueryInterface
+ jQueryMock.fn.carousel = Carousel.jQueryInterface
jQueryMock.elements = [div]
jQueryMock.fn.carousel.call(jQueryMock, slideTo)
@@ -1088,7 +1088,7 @@ describe('Carousel', () => {
const div = fixtureEl.querySelector('div')
const action = 'undefinedMethod'
- jQueryMock.fn.carousel = Carousel._jQueryInterface
+ jQueryMock.fn.carousel = Carousel.jQueryInterface
jQueryMock.elements = [div]
try {
@@ -1108,7 +1108,7 @@ describe('Carousel', () => {
window.dispatchEvent(loadEvent)
- expect(Carousel._getInstance(carouselEl)).toBeDefined()
+ expect(Carousel.getInstance(carouselEl)).toBeDefined()
})
it('should create carousel and go to the next slide on click', done => {
diff --git a/js/src/collapse/collapse.js b/js/src/collapse/collapse.js
index c1d9aa2f1b..7990857763 100644
--- a/js/src/collapse/collapse.js
+++ b/js/src/collapse/collapse.js
@@ -173,7 +173,7 @@ class Collapse {
if (actives) {
actives.forEach(elemActive => {
if (container !== elemActive) {
- Collapse._collapseInterface(elemActive, 'hide')
+ Collapse.collapseInterface(elemActive, 'hide')
}
if (!activesData) {
@@ -348,7 +348,7 @@ class Collapse {
// Static
- static _collapseInterface(element, config) {
+ static collapseInterface(element, config) {
let data = Data.getData(element, DATA_KEY)
const _config = {
...Default,
@@ -373,13 +373,13 @@ class Collapse {
}
}
- static _jQueryInterface(config) {
+ static jQueryInterface(config) {
return this.each(function () {
- Collapse._collapseInterface(this, config)
+ Collapse.collapseInterface(this, config)
})
}
- static _getInstance(element) {
+ static getInstance(element) {
return Data.getData(element, DATA_KEY)
}
}
@@ -415,7 +415,7 @@ EventHandler.on(document, Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (
config = triggerData
}
- Collapse._collapseInterface(element, config)
+ Collapse.collapseInterface(element, config)
})
})
@@ -428,11 +428,11 @@ EventHandler.on(document, Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (
/* istanbul ignore if */
if (typeof $ !== 'undefined') {
const JQUERY_NO_CONFLICT = $.fn[NAME]
- $.fn[NAME] = Collapse._jQueryInterface
+ $.fn[NAME] = Collapse.jQueryInterface
$.fn[NAME].Constructor = Collapse
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT
- return Collapse._jQueryInterface
+ return Collapse.jQueryInterface
}
}
diff --git a/js/src/collapse/collapse.spec.js b/js/src/collapse/collapse.spec.js
index 731b4a25f8..154bc2c6bb 100644
--- a/js/src/collapse/collapse.spec.js
+++ b/js/src/collapse/collapse.spec.js
@@ -366,11 +366,11 @@ describe('Collapse', () => {
toggle: false
})
- expect(Collapse._getInstance(collapseEl)).toEqual(collapse)
+ expect(Collapse.getInstance(collapseEl)).toEqual(collapse)
collapse.dispose()
- expect(Collapse._getInstance(collapseEl)).toEqual(null)
+ expect(Collapse.getInstance(collapseEl)).toEqual(null)
})
})
@@ -760,18 +760,18 @@ describe('Collapse', () => {
})
})
- describe('_jQueryInterface', () => {
+ describe('jQueryInterface', () => {
it('should create a collapse', () => {
fixtureEl.innerHTML = '
'
const div = fixtureEl.querySelector('div')
- jQueryMock.fn.collapse = Collapse._jQueryInterface
+ jQueryMock.fn.collapse = Collapse.jQueryInterface
jQueryMock.elements = [div]
jQueryMock.fn.collapse.call(jQueryMock)
- expect(Collapse._getInstance(div)).toBeDefined()
+ expect(Collapse.getInstance(div)).toBeDefined()
})
it('should not re create a collapse', () => {
@@ -780,12 +780,12 @@ describe('Collapse', () => {
const div = fixtureEl.querySelector('div')
const collapse = new Collapse(div)
- jQueryMock.fn.collapse = Collapse._jQueryInterface
+ jQueryMock.fn.collapse = Collapse.jQueryInterface
jQueryMock.elements = [div]
jQueryMock.fn.collapse.call(jQueryMock)
- expect(Collapse._getInstance(div)).toEqual(collapse)
+ expect(Collapse.getInstance(div)).toEqual(collapse)
})
it('should throw error on undefined method', () => {
@@ -794,7 +794,7 @@ describe('Collapse', () => {
const div = fixtureEl.querySelector('div')
const action = 'undefinedMethod'
- jQueryMock.fn.collapse = Collapse._jQueryInterface
+ jQueryMock.fn.collapse = Collapse.jQueryInterface
jQueryMock.elements = [div]
try {
@@ -805,14 +805,14 @@ describe('Collapse', () => {
})
})
- describe('_getInstance', () => {
+ describe('getInstance', () => {
it('should return collapse instance', () => {
fixtureEl.innerHTML = '
'
const div = fixtureEl.querySelector('div')
const collapse = new Collapse(div)
- expect(Collapse._getInstance(div)).toEqual(collapse)
+ expect(Collapse.getInstance(div)).toEqual(collapse)
})
it('should return null when there is no collapse instance', () => {
@@ -820,7 +820,7 @@ describe('Collapse', () => {
const div = fixtureEl.querySelector('div')
- expect(Collapse._getInstance(div)).toEqual(null)
+ expect(Collapse.getInstance(div)).toEqual(null)
})
})
})
diff --git a/js/src/dropdown/dropdown.js b/js/src/dropdown/dropdown.js
index f30c3924b3..7f5264d050 100644
--- a/js/src/dropdown/dropdown.js
+++ b/js/src/dropdown/dropdown.js
@@ -133,10 +133,10 @@ class Dropdown {
return
}
- const parent = Dropdown._getParentFromElement(this._element)
+ const parent = Dropdown.getParentFromElement(this._element)
const isActive = this._menu.classList.contains(ClassName.SHOW)
- Dropdown._clearMenus()
+ Dropdown.clearMenus()
if (isActive) {
return
@@ -207,7 +207,7 @@ class Dropdown {
return
}
- const parent = Dropdown._getParentFromElement(this._element)
+ const parent = Dropdown.getParentFromElement(this._element)
const relatedTarget = {
relatedTarget: this._element
}
@@ -228,7 +228,7 @@ class Dropdown {
return
}
- const parent = Dropdown._getParentFromElement(this._element)
+ const parent = Dropdown.getParentFromElement(this._element)
const relatedTarget = {
relatedTarget: this._element
}
@@ -289,7 +289,7 @@ class Dropdown {
}
_getMenuElement() {
- const parent = Dropdown._getParentFromElement(this._element)
+ const parent = Dropdown.getParentFromElement(this._element)
return SelectorEngine.findOne(Selector.MENU, parent)
}
@@ -364,7 +364,7 @@ class Dropdown {
// Static
- static _dropdownInterface(element, config) {
+ static dropdownInterface(element, config) {
let data = Data.getData(element, DATA_KEY)
const _config = typeof config === 'object' ? config : null
@@ -381,13 +381,13 @@ class Dropdown {
}
}
- static _jQueryInterface(config) {
+ static jQueryInterface(config) {
return this.each(function () {
- Dropdown._dropdownInterface(this, config)
+ Dropdown.dropdownInterface(this, config)
})
}
- static _clearMenus(event) {
+ static clearMenus(event) {
if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH ||
event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
return
@@ -395,7 +395,7 @@ class Dropdown {
const toggles = makeArray(SelectorEngine.find(Selector.DATA_TOGGLE))
for (let i = 0, len = toggles.length; i < len; i++) {
- const parent = Dropdown._getParentFromElement(toggles[i])
+ const parent = Dropdown.getParentFromElement(toggles[i])
const context = Data.getData(toggles[i], DATA_KEY)
const relatedTarget = {
relatedTarget: toggles[i]
@@ -441,11 +441,11 @@ class Dropdown {
}
}
- static _getParentFromElement(element) {
+ static getParentFromElement(element) {
return getElementFromSelector(element) || element.parentNode
}
- static _dataApiKeydownHandler(event) {
+ static dataApiKeydownHandler(event) {
// If not input/textarea:
// - And not a key in REGEXP_KEYDOWN => not a dropdown command
// If input/textarea:
@@ -468,7 +468,7 @@ class Dropdown {
return
}
- const parent = Dropdown._getParentFromElement(this)
+ const parent = Dropdown.getParentFromElement(this)
const isActive = parent.classList.contains(ClassName.SHOW)
if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
@@ -476,7 +476,7 @@ class Dropdown {
SelectorEngine.findOne(Selector.DATA_TOGGLE, parent).focus()
}
- Dropdown._clearMenus()
+ Dropdown.clearMenus()
return
}
@@ -503,7 +503,7 @@ class Dropdown {
items[index].focus()
}
- static _getInstance(element) {
+ static getInstance(element) {
return Data.getData(element, DATA_KEY)
}
}
@@ -514,14 +514,14 @@ class Dropdown {
* ------------------------------------------------------------------------
*/
-EventHandler.on(document, Event.KEYDOWN_DATA_API, Selector.DATA_TOGGLE, Dropdown._dataApiKeydownHandler)
-EventHandler.on(document, Event.KEYDOWN_DATA_API, Selector.MENU, Dropdown._dataApiKeydownHandler)
-EventHandler.on(document, Event.CLICK_DATA_API, Dropdown._clearMenus)
-EventHandler.on(document, Event.KEYUP_DATA_API, Dropdown._clearMenus)
+EventHandler.on(document, Event.KEYDOWN_DATA_API, Selector.DATA_TOGGLE, Dropdown.dataApiKeydownHandler)
+EventHandler.on(document, Event.KEYDOWN_DATA_API, Selector.MENU, Dropdown.dataApiKeydownHandler)
+EventHandler.on(document, Event.CLICK_DATA_API, Dropdown.clearMenus)
+EventHandler.on(document, Event.KEYUP_DATA_API, Dropdown.clearMenus)
EventHandler.on(document, Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
event.preventDefault()
event.stopPropagation()
- Dropdown._dropdownInterface(this, 'toggle')
+ Dropdown.dropdownInterface(this, 'toggle')
})
EventHandler
.on(document, Event.CLICK_DATA_API, Selector.FORM_CHILD, e => e.stopPropagation())
@@ -535,11 +535,11 @@ EventHandler
/* istanbul ignore if */
if (typeof $ !== 'undefined') {
const JQUERY_NO_CONFLICT = $.fn[NAME]
- $.fn[NAME] = Dropdown._jQueryInterface
+ $.fn[NAME] = Dropdown.jQueryInterface
$.fn[NAME].Constructor = Dropdown
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT
- return Dropdown._jQueryInterface
+ return Dropdown.jQueryInterface
}
}
diff --git a/js/src/dropdown/dropdown.spec.js b/js/src/dropdown/dropdown.spec.js
index 2d9719d5da..92d8fea033 100644
--- a/js/src/dropdown/dropdown.spec.js
+++ b/js/src/dropdown/dropdown.spec.js
@@ -1412,18 +1412,18 @@ describe('Dropdown', () => {
})
})
- describe('_jQueryInterface', () => {
+ describe('jQueryInterface', () => {
it('should create a dropdown', () => {
fixtureEl.innerHTML = '
'
const div = fixtureEl.querySelector('div')
- jQueryMock.fn.dropdown = Dropdown._jQueryInterface
+ jQueryMock.fn.dropdown = Dropdown.jQueryInterface
jQueryMock.elements = [div]
jQueryMock.fn.dropdown.call(jQueryMock)
- expect(Dropdown._getInstance(div)).toBeDefined()
+ expect(Dropdown.getInstance(div)).toBeDefined()
})
it('should not re create a dropdown', () => {
@@ -1432,12 +1432,12 @@ describe('Dropdown', () => {
const div = fixtureEl.querySelector('div')
const dropdown = new Dropdown(div)
- jQueryMock.fn.dropdown = Dropdown._jQueryInterface
+ jQueryMock.fn.dropdown = Dropdown.jQueryInterface
jQueryMock.elements = [div]
jQueryMock.fn.dropdown.call(jQueryMock)
- expect(Dropdown._getInstance(div)).toEqual(dropdown)
+ expect(Dropdown.getInstance(div)).toEqual(dropdown)
})
it('should throw error on undefined method', () => {
@@ -1446,7 +1446,7 @@ describe('Dropdown', () => {
const div = fixtureEl.querySelector('div')
const action = 'undefinedMethod'
- jQueryMock.fn.dropdown = Dropdown._jQueryInterface
+ jQueryMock.fn.dropdown = Dropdown.jQueryInterface
jQueryMock.elements = [div]
try {
@@ -1457,14 +1457,14 @@ describe('Dropdown', () => {
})
})
- describe('_getInstance', () => {
+ describe('getInstance', () => {
it('should return dropdown instance', () => {
fixtureEl.innerHTML = '
'
const div = fixtureEl.querySelector('div')
const dropdown = new Dropdown(div)
- expect(Dropdown._getInstance(div)).toEqual(dropdown)
+ expect(Dropdown.getInstance(div)).toEqual(dropdown)
})
it('should return null when there is no dropdown instance', () => {
@@ -1472,7 +1472,7 @@ describe('Dropdown', () => {
const div = fixtureEl.querySelector('div')
- expect(Dropdown._getInstance(div)).toEqual(null)
+ expect(Dropdown.getInstance(div)).toEqual(null)
})
})
})
diff --git a/js/src/modal/modal.js b/js/src/modal/modal.js
index 5d74249374..fd24b7768f 100644
--- a/js/src/modal/modal.js
+++ b/js/src/modal/modal.js
@@ -513,7 +513,7 @@ class Modal {
// Static
- static _jQueryInterface(config, relatedTarget) {
+ static jQueryInterface(config, relatedTarget) {
return this.each(function () {
let data = Data.getData(this, DATA_KEY)
const _config = {
@@ -538,7 +538,7 @@ class Modal {
})
}
- static _getInstance(element) {
+ static getInstance(element) {
return Data.getData(element, DATA_KEY)
}
}
@@ -591,11 +591,11 @@ EventHandler.on(document, Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (
/* istanbul ignore if */
if (typeof $ !== 'undefined') {
const JQUERY_NO_CONFLICT = $.fn[NAME]
- $.fn[NAME] = Modal._jQueryInterface
+ $.fn[NAME] = Modal.jQueryInterface
$.fn[NAME].Constructor = Modal
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT
- return Modal._jQueryInterface
+ return Modal.jQueryInterface
}
}
diff --git a/js/src/modal/modal.spec.js b/js/src/modal/modal.spec.js
index 5111f00a9a..5623d174c6 100644
--- a/js/src/modal/modal.spec.js
+++ b/js/src/modal/modal.spec.js
@@ -711,13 +711,13 @@ describe('Modal', () => {
const modalEl = fixtureEl.querySelector('.modal')
const modal = new Modal(modalEl)
- expect(Modal._getInstance(modalEl)).toEqual(modal)
+ expect(Modal.getInstance(modalEl)).toEqual(modal)
spyOn(EventHandler, 'off')
modal.dispose()
- expect(Modal._getInstance(modalEl)).toEqual(null)
+ expect(Modal.getInstance(modalEl)).toEqual(null)
expect(EventHandler.off).toHaveBeenCalledTimes(4)
})
})
@@ -813,7 +813,7 @@ describe('Modal', () => {
spyOn(trigger, 'focus')
modalEl.addEventListener('shown.bs.modal', () => {
- const modal = Modal._getInstance(modalEl)
+ const modal = Modal.getInstance(modalEl)
modal.hide()
})
@@ -844,7 +844,7 @@ describe('Modal', () => {
spyOn(trigger, 'focus')
modalEl.addEventListener('shown.bs.modal', () => {
- const modal = Modal._getInstance(modalEl)
+ const modal = Modal.getInstance(modalEl)
modal.hide()
})
@@ -890,18 +890,18 @@ describe('Modal', () => {
})
})
- describe('_jQueryInterface', () => {
+ describe('jQueryInterface', () => {
it('should create a modal', () => {
fixtureEl.innerHTML = ''
const div = fixtureEl.querySelector('div')
- jQueryMock.fn.modal = Modal._jQueryInterface
+ jQueryMock.fn.modal = Modal.jQueryInterface
jQueryMock.elements = [div]
jQueryMock.fn.modal.call(jQueryMock)
- expect(Modal._getInstance(div)).toBeDefined()
+ expect(Modal.getInstance(div)).toBeDefined()
})
it('should not re create a modal', () => {
@@ -910,12 +910,12 @@ describe('Modal', () => {
const div = fixtureEl.querySelector('div')
const modal = new Modal(div)
- jQueryMock.fn.modal = Modal._jQueryInterface
+ jQueryMock.fn.modal = Modal.jQueryInterface
jQueryMock.elements = [div]
jQueryMock.fn.modal.call(jQueryMock)
- expect(Modal._getInstance(div)).toEqual(modal)
+ expect(Modal.getInstance(div)).toEqual(modal)
})
it('should throw error on undefined method', () => {
@@ -924,7 +924,7 @@ describe('Modal', () => {
const div = fixtureEl.querySelector('div')
const action = 'undefinedMethod'
- jQueryMock.fn.modal = Modal._jQueryInterface
+ jQueryMock.fn.modal = Modal.jQueryInterface
jQueryMock.elements = [div]
try {
@@ -940,7 +940,7 @@ describe('Modal', () => {
const div = fixtureEl.querySelector('div')
const modal = new Modal(div)
- jQueryMock.fn.modal = Modal._jQueryInterface
+ jQueryMock.fn.modal = Modal.jQueryInterface
jQueryMock.elements = [div]
spyOn(modal, 'show')
@@ -955,7 +955,7 @@ describe('Modal', () => {
const div = fixtureEl.querySelector('div')
- jQueryMock.fn.modal = Modal._jQueryInterface
+ jQueryMock.fn.modal = Modal.jQueryInterface
jQueryMock.elements = [div]
spyOn(Modal.prototype, 'show')
@@ -966,14 +966,14 @@ describe('Modal', () => {
})
})
- describe('_getInstance', () => {
+ describe('getInstance', () => {
it('should return modal instance', () => {
fixtureEl.innerHTML = ''
const div = fixtureEl.querySelector('div')
const modal = new Modal(div)
- expect(Modal._getInstance(div)).toEqual(modal)
+ expect(Modal.getInstance(div)).toEqual(modal)
})
it('should return null when there is no modal instance', () => {
@@ -981,7 +981,7 @@ describe('Modal', () => {
const div = fixtureEl.querySelector('div')
- expect(Modal._getInstance(div)).toEqual(null)
+ expect(Modal.getInstance(div)).toEqual(null)
})
})
})
diff --git a/js/src/popover/popover.js b/js/src/popover/popover.js
index cf4b776499..ce92e0d559 100644
--- a/js/src/popover/popover.js
+++ b/js/src/popover/popover.js
@@ -144,7 +144,7 @@ class Popover extends Tooltip {
// Static
- static _jQueryInterface(config) {
+ static jQueryInterface(config) {
return this.each(function () {
let data = Data.getData(this, DATA_KEY)
const _config = typeof config === 'object' ? config : null
@@ -168,7 +168,7 @@ class Popover extends Tooltip {
})
}
- static _getInstance(element) {
+ static getInstance(element) {
return Data.getData(element, DATA_KEY)
}
}
@@ -181,11 +181,11 @@ class Popover extends Tooltip {
/* istanbul ignore if */
if (typeof $ !== 'undefined') {
const JQUERY_NO_CONFLICT = $.fn[NAME]
- $.fn[NAME] = Popover._jQueryInterface
+ $.fn[NAME] = Popover.jQueryInterface
$.fn[NAME].Constructor = Popover
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT
- return Popover._jQueryInterface
+ return Popover.jQueryInterface
}
}
diff --git a/js/src/popover/popover.spec.js b/js/src/popover/popover.spec.js
index 003c0168f6..cf82e36ef1 100644
--- a/js/src/popover/popover.spec.js
+++ b/js/src/popover/popover.spec.js
@@ -139,18 +139,18 @@ describe('Popover', () => {
})
})
- describe('_jQueryInterface', () => {
+ describe('jQueryInterface', () => {
it('should create a popover', () => {
fixtureEl.innerHTML = 'BS twitter '
const popoverEl = fixtureEl.querySelector('a')
- jQueryMock.fn.popover = Popover._jQueryInterface
+ jQueryMock.fn.popover = Popover.jQueryInterface
jQueryMock.elements = [popoverEl]
jQueryMock.fn.popover.call(jQueryMock)
- expect(Popover._getInstance(popoverEl)).toBeDefined()
+ expect(Popover.getInstance(popoverEl)).toBeDefined()
})
it('should create a popover with a config object', () => {
@@ -158,14 +158,14 @@ describe('Popover', () => {
const popoverEl = fixtureEl.querySelector('a')
- jQueryMock.fn.popover = Popover._jQueryInterface
+ jQueryMock.fn.popover = Popover.jQueryInterface
jQueryMock.elements = [popoverEl]
jQueryMock.fn.popover.call(jQueryMock, {
content: 'Popover content'
})
- expect(Popover._getInstance(popoverEl)).toBeDefined()
+ expect(Popover.getInstance(popoverEl)).toBeDefined()
})
it('should not re create a popover', () => {
@@ -174,12 +174,12 @@ describe('Popover', () => {
const popoverEl = fixtureEl.querySelector('a')
const popover = new Popover(popoverEl)
- jQueryMock.fn.popover = Popover._jQueryInterface
+ jQueryMock.fn.popover = Popover.jQueryInterface
jQueryMock.elements = [popoverEl]
jQueryMock.fn.popover.call(jQueryMock)
- expect(Popover._getInstance(popoverEl)).toEqual(popover)
+ expect(Popover.getInstance(popoverEl)).toEqual(popover)
})
it('should throw error on undefined method', () => {
@@ -188,7 +188,7 @@ describe('Popover', () => {
const popoverEl = fixtureEl.querySelector('a')
const action = 'undefinedMethod'
- jQueryMock.fn.popover = Popover._jQueryInterface
+ jQueryMock.fn.popover = Popover.jQueryInterface
jQueryMock.elements = [popoverEl]
try {
@@ -204,7 +204,7 @@ describe('Popover', () => {
const popoverEl = fixtureEl.querySelector('a')
const popover = new Popover(popoverEl)
- jQueryMock.fn.popover = Popover._jQueryInterface
+ jQueryMock.fn.popover = Popover.jQueryInterface
jQueryMock.elements = [popoverEl]
spyOn(popover, 'show')
@@ -219,7 +219,7 @@ describe('Popover', () => {
const popoverEl = fixtureEl.querySelector('a')
- jQueryMock.fn.popover = Popover._jQueryInterface
+ jQueryMock.fn.popover = Popover.jQueryInterface
jQueryMock.elements = [popoverEl]
spyOn(Popover.prototype, 'dispose')
@@ -230,14 +230,14 @@ describe('Popover', () => {
})
})
- describe('_getInstance', () => {
+ describe('getInstance', () => {
it('should return popover instance', () => {
fixtureEl.innerHTML = 'BS twitter '
const popoverEl = fixtureEl.querySelector('a')
const popover = new Popover(popoverEl)
- expect(Popover._getInstance(popoverEl)).toEqual(popover)
+ expect(Popover.getInstance(popoverEl)).toEqual(popover)
})
it('should return null when there is no popover instance', () => {
@@ -245,7 +245,7 @@ describe('Popover', () => {
const popoverEl = fixtureEl.querySelector('a')
- expect(Popover._getInstance(popoverEl)).toEqual(null)
+ expect(Popover.getInstance(popoverEl)).toEqual(null)
})
})
})
diff --git a/js/src/scrollspy/scrollspy.js b/js/src/scrollspy/scrollspy.js
index 68c51f7d7b..b3b87a3b23 100644
--- a/js/src/scrollspy/scrollspy.js
+++ b/js/src/scrollspy/scrollspy.js
@@ -301,7 +301,7 @@ class ScrollSpy {
// Static
- static _jQueryInterface(config) {
+ static jQueryInterface(config) {
return this.each(function () {
let data = Data.getData(this, DATA_KEY)
const _config = typeof config === 'object' && config
@@ -320,7 +320,7 @@ class ScrollSpy {
})
}
- static _getInstance(element) {
+ static getInstance(element) {
return Data.getData(element, DATA_KEY)
}
}
@@ -344,11 +344,11 @@ EventHandler.on(window, Event.LOAD_DATA_API, () => {
/* istanbul ignore if */
if (typeof $ !== 'undefined') {
const JQUERY_NO_CONFLICT = $.fn[NAME]
- $.fn[NAME] = ScrollSpy._jQueryInterface
+ $.fn[NAME] = ScrollSpy.jQueryInterface
$.fn[NAME].Constructor = ScrollSpy
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT
- return ScrollSpy._jQueryInterface
+ return ScrollSpy.jQueryInterface
}
}
diff --git a/js/src/scrollspy/scrollspy.spec.js b/js/src/scrollspy/scrollspy.spec.js
index f9b6fd29eb..a019a6d1af 100644
--- a/js/src/scrollspy/scrollspy.spec.js
+++ b/js/src/scrollspy/scrollspy.spec.js
@@ -571,18 +571,18 @@ describe('ScrollSpy', () => {
})
})
- describe('_jQueryInterface', () => {
+ describe('jQueryInterface', () => {
it('should create a scrollspy', () => {
fixtureEl.innerHTML = '
'
const div = fixtureEl.querySelector('div')
- jQueryMock.fn.scrollspy = ScrollSpy._jQueryInterface
+ jQueryMock.fn.scrollspy = ScrollSpy.jQueryInterface
jQueryMock.elements = [div]
jQueryMock.fn.scrollspy.call(jQueryMock)
- expect(ScrollSpy._getInstance(div)).toBeDefined()
+ expect(ScrollSpy.getInstance(div)).toBeDefined()
})
it('should not re create a scrollspy', () => {
@@ -591,12 +591,12 @@ describe('ScrollSpy', () => {
const div = fixtureEl.querySelector('div')
const scrollSpy = new ScrollSpy(div)
- jQueryMock.fn.scrollspy = ScrollSpy._jQueryInterface
+ jQueryMock.fn.scrollspy = ScrollSpy.jQueryInterface
jQueryMock.elements = [div]
jQueryMock.fn.scrollspy.call(jQueryMock)
- expect(ScrollSpy._getInstance(div)).toEqual(scrollSpy)
+ expect(ScrollSpy.getInstance(div)).toEqual(scrollSpy)
})
it('should call a scrollspy method', () => {
@@ -607,12 +607,12 @@ describe('ScrollSpy', () => {
spyOn(scrollSpy, 'refresh')
- jQueryMock.fn.scrollspy = ScrollSpy._jQueryInterface
+ jQueryMock.fn.scrollspy = ScrollSpy.jQueryInterface
jQueryMock.elements = [div]
jQueryMock.fn.scrollspy.call(jQueryMock, 'refresh')
- expect(ScrollSpy._getInstance(div)).toEqual(scrollSpy)
+ expect(ScrollSpy.getInstance(div)).toEqual(scrollSpy)
expect(scrollSpy.refresh).toHaveBeenCalled()
})
@@ -622,7 +622,7 @@ describe('ScrollSpy', () => {
const div = fixtureEl.querySelector('div')
const action = 'undefinedMethod'
- jQueryMock.fn.scrollspy = ScrollSpy._jQueryInterface
+ jQueryMock.fn.scrollspy = ScrollSpy.jQueryInterface
jQueryMock.elements = [div]
try {
@@ -633,9 +633,9 @@ describe('ScrollSpy', () => {
})
})
- describe('_getInstance', () => {
+ describe('getInstance', () => {
it('should return null if there is no instance', () => {
- expect(ScrollSpy._getInstance(fixtureEl)).toEqual(null)
+ expect(ScrollSpy.getInstance(fixtureEl)).toEqual(null)
})
})
@@ -647,7 +647,7 @@ describe('ScrollSpy', () => {
window.dispatchEvent(createEvent('load'))
- expect(ScrollSpy._getInstance(scrollSpyEl)).not.toBeNull()
+ expect(ScrollSpy.getInstance(scrollSpyEl)).not.toBeNull()
})
})
})
diff --git a/js/src/tab/tab.js b/js/src/tab/tab.js
index c9f4869ef6..2d4b8e30c4 100644
--- a/js/src/tab/tab.js
+++ b/js/src/tab/tab.js
@@ -210,7 +210,7 @@ class Tab {
// Static
- static _jQueryInterface(config) {
+ static jQueryInterface(config) {
return this.each(function () {
const data = Data.getData(this, DATA_KEY) || new Tab(this)
@@ -224,7 +224,7 @@ class Tab {
})
}
- static _getInstance(element) {
+ static getInstance(element) {
return Data.getData(element, DATA_KEY)
}
}
@@ -251,11 +251,11 @@ EventHandler.on(document, Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (
/* istanbul ignore if */
if (typeof $ !== 'undefined') {
const JQUERY_NO_CONFLICT = $.fn[NAME]
- $.fn[NAME] = Tab._jQueryInterface
+ $.fn[NAME] = Tab.jQueryInterface
$.fn[NAME].Constructor = Tab
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT
- return Tab._jQueryInterface
+ return Tab.jQueryInterface
}
}
diff --git a/js/src/tab/tab.spec.js b/js/src/tab/tab.spec.js
index 3fae366d19..9530f3def1 100644
--- a/js/src/tab/tab.spec.js
+++ b/js/src/tab/tab.spec.js
@@ -329,26 +329,26 @@ describe('Tab', () => {
const el = fixtureEl.querySelector('div')
const tab = new Tab(fixtureEl.querySelector('div'))
- expect(Tab._getInstance(el)).not.toBeNull()
+ expect(Tab.getInstance(el)).not.toBeNull()
tab.dispose()
- expect(Tab._getInstance(el)).toBeNull()
+ expect(Tab.getInstance(el)).toBeNull()
})
})
- describe('_jQueryInterface', () => {
+ describe('jQueryInterface', () => {
it('should create a tab', () => {
fixtureEl.innerHTML = '
'
const div = fixtureEl.querySelector('div')
- jQueryMock.fn.tab = Tab._jQueryInterface
+ jQueryMock.fn.tab = Tab.jQueryInterface
jQueryMock.elements = [div]
jQueryMock.fn.tab.call(jQueryMock)
- expect(Tab._getInstance(div)).toBeDefined()
+ expect(Tab.getInstance(div)).toBeDefined()
})
it('should not re create a tab', () => {
@@ -357,12 +357,12 @@ describe('Tab', () => {
const div = fixtureEl.querySelector('div')
const tab = new Tab(div)
- jQueryMock.fn.tab = Tab._jQueryInterface
+ jQueryMock.fn.tab = Tab.jQueryInterface
jQueryMock.elements = [div]
jQueryMock.fn.tab.call(jQueryMock)
- expect(Tab._getInstance(div)).toEqual(tab)
+ expect(Tab.getInstance(div)).toEqual(tab)
})
it('should call a tab method', () => {
@@ -373,12 +373,12 @@ describe('Tab', () => {
spyOn(tab, 'show')
- jQueryMock.fn.tab = Tab._jQueryInterface
+ jQueryMock.fn.tab = Tab.jQueryInterface
jQueryMock.elements = [div]
jQueryMock.fn.tab.call(jQueryMock, 'show')
- expect(Tab._getInstance(div)).toEqual(tab)
+ expect(Tab.getInstance(div)).toEqual(tab)
expect(tab.show).toHaveBeenCalled()
})
@@ -388,7 +388,7 @@ describe('Tab', () => {
const div = fixtureEl.querySelector('div')
const action = 'undefinedMethod'
- jQueryMock.fn.tab = Tab._jQueryInterface
+ jQueryMock.fn.tab = Tab.jQueryInterface
jQueryMock.elements = [div]
try {
@@ -399,9 +399,9 @@ describe('Tab', () => {
})
})
- describe('_getInstance', () => {
+ describe('getInstance', () => {
it('should return null if there is no instance', () => {
- expect(Tab._getInstance(fixtureEl)).toEqual(null)
+ expect(Tab.getInstance(fixtureEl)).toEqual(null)
})
it('should return this instance', () => {
@@ -410,7 +410,7 @@ describe('Tab', () => {
const divEl = fixtureEl.querySelector('div')
const tab = new Tab(divEl)
- expect(Tab._getInstance(divEl)).toEqual(tab)
+ expect(Tab.getInstance(divEl)).toEqual(tab)
})
})
diff --git a/js/src/toast/toast.js b/js/src/toast/toast.js
index 04d3a05f80..51a7c8b353 100644
--- a/js/src/toast/toast.js
+++ b/js/src/toast/toast.js
@@ -198,7 +198,7 @@ class Toast {
// Static
- static _jQueryInterface(config) {
+ static jQueryInterface(config) {
return this.each(function () {
let data = Data.getData(this, DATA_KEY)
const _config = typeof config === 'object' && config
@@ -217,7 +217,7 @@ class Toast {
})
}
- static _getInstance(element) {
+ static getInstance(element) {
return Data.getData(element, DATA_KEY)
}
}
@@ -231,11 +231,11 @@ class Toast {
/* istanbul ignore if */
if (typeof $ !== 'undefined') {
const JQUERY_NO_CONFLICT = $.fn[NAME]
- $.fn[NAME] = Toast._jQueryInterface
+ $.fn[NAME] = Toast.jQueryInterface
$.fn[NAME].Constructor = Toast
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT
- return Toast._jQueryInterface
+ return Toast.jQueryInterface
}
}
diff --git a/js/src/toast/toast.spec.js b/js/src/toast/toast.spec.js
index dec6313b2d..b00b860856 100644
--- a/js/src/toast/toast.spec.js
+++ b/js/src/toast/toast.spec.js
@@ -253,11 +253,11 @@ describe('Toast', () => {
const toastEl = fixtureEl.querySelector('div')
const toast = new Toast(toastEl)
- expect(Toast._getInstance(toastEl)).toBeDefined()
+ expect(Toast.getInstance(toastEl)).toBeDefined()
toast.dispose()
- expect(Toast._getInstance(toastEl)).toBeNull()
+ expect(Toast.getInstance(toastEl)).toBeNull()
})
it('should allow to destroy toast and hide it before that', done => {
@@ -273,11 +273,11 @@ describe('Toast', () => {
const toast = new Toast(toastEl)
const expected = () => {
expect(toastEl.classList.contains('show')).toEqual(true)
- expect(Toast._getInstance(toastEl)).toBeDefined()
+ expect(Toast.getInstance(toastEl)).toBeDefined()
toast.dispose()
- expect(Toast._getInstance(toastEl)).toBeNull()
+ expect(Toast.getInstance(toastEl)).toBeNull()
expect(toastEl.classList.contains('show')).toEqual(false)
done()
@@ -291,18 +291,18 @@ describe('Toast', () => {
})
})
- describe('_jQueryInterface', () => {
+ describe('jQueryInterface', () => {
it('should create a toast', () => {
fixtureEl.innerHTML = '
'
const div = fixtureEl.querySelector('div')
- jQueryMock.fn.toast = Toast._jQueryInterface
+ jQueryMock.fn.toast = Toast.jQueryInterface
jQueryMock.elements = [div]
jQueryMock.fn.toast.call(jQueryMock)
- expect(Toast._getInstance(div)).toBeDefined()
+ expect(Toast.getInstance(div)).toBeDefined()
})
it('should not re create a toast', () => {
@@ -311,12 +311,12 @@ describe('Toast', () => {
const div = fixtureEl.querySelector('div')
const toast = new Toast(div)
- jQueryMock.fn.toast = Toast._jQueryInterface
+ jQueryMock.fn.toast = Toast.jQueryInterface
jQueryMock.elements = [div]
jQueryMock.fn.toast.call(jQueryMock)
- expect(Toast._getInstance(div)).toEqual(toast)
+ expect(Toast.getInstance(div)).toEqual(toast)
})
it('should call a toast method', () => {
@@ -327,12 +327,12 @@ describe('Toast', () => {
spyOn(toast, 'show')
- jQueryMock.fn.toast = Toast._jQueryInterface
+ jQueryMock.fn.toast = Toast.jQueryInterface
jQueryMock.elements = [div]
jQueryMock.fn.toast.call(jQueryMock, 'show')
- expect(Toast._getInstance(div)).toEqual(toast)
+ expect(Toast.getInstance(div)).toEqual(toast)
expect(toast.show).toHaveBeenCalled()
})
@@ -342,7 +342,7 @@ describe('Toast', () => {
const div = fixtureEl.querySelector('div')
const action = 'undefinedMethod'
- jQueryMock.fn.toast = Toast._jQueryInterface
+ jQueryMock.fn.toast = Toast.jQueryInterface
jQueryMock.elements = [div]
try {
@@ -353,14 +353,14 @@ describe('Toast', () => {
})
})
- describe('_getInstance', () => {
+ describe('getInstance', () => {
it('should return collapse instance', () => {
fixtureEl.innerHTML = '
'
const div = fixtureEl.querySelector('div')
const toast = new Toast(div)
- expect(Toast._getInstance(div)).toEqual(toast)
+ expect(Toast.getInstance(div)).toEqual(toast)
})
it('should return null when there is no collapse instance', () => {
@@ -368,7 +368,7 @@ describe('Toast', () => {
const div = fixtureEl.querySelector('div')
- expect(Toast._getInstance(div)).toEqual(null)
+ expect(Toast.getInstance(div)).toEqual(null)
})
})
})
diff --git a/js/src/tooltip/tooltip.js b/js/src/tooltip/tooltip.js
index 1db233e798..7575bb89db 100644
--- a/js/src/tooltip/tooltip.js
+++ b/js/src/tooltip/tooltip.js
@@ -770,7 +770,7 @@ class Tooltip {
// Static
- static _jQueryInterface(config) {
+ static jQueryInterface(config) {
return this.each(function () {
let data = Data.getData(this, DATA_KEY)
const _config = typeof config === 'object' && config
@@ -793,7 +793,7 @@ class Tooltip {
})
}
- static _getInstance(element) {
+ static getInstance(element) {
return Data.getData(element, DATA_KEY)
}
}
@@ -807,11 +807,11 @@ class Tooltip {
/* istanbul ignore if */
if (typeof $ !== 'undefined') {
const JQUERY_NO_CONFLICT = $.fn[NAME]
- $.fn[NAME] = Tooltip._jQueryInterface
+ $.fn[NAME] = Tooltip.jQueryInterface
$.fn[NAME].Constructor = Tooltip
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT
- return Tooltip._jQueryInterface
+ return Tooltip.jQueryInterface
}
}
diff --git a/js/src/tooltip/tooltip.spec.js b/js/src/tooltip/tooltip.spec.js
index 6f02dfa9b7..1e858d369a 100644
--- a/js/src/tooltip/tooltip.spec.js
+++ b/js/src/tooltip/tooltip.spec.js
@@ -266,11 +266,11 @@ describe('Tooltip', () => {
const tooltipEl = fixtureEl.querySelector('a')
const tooltip = new Tooltip(tooltipEl)
- expect(Tooltip._getInstance(tooltipEl)).toEqual(tooltip)
+ expect(Tooltip.getInstance(tooltipEl)).toEqual(tooltip)
tooltip.dispose()
- expect(Tooltip._getInstance(tooltipEl)).toEqual(null)
+ expect(Tooltip.getInstance(tooltipEl)).toEqual(null)
})
it('should destroy a tooltip and remove it from the dom', done => {
@@ -926,18 +926,18 @@ describe('Tooltip', () => {
})
})
- describe('_jQueryInterface', () => {
+ describe('jQueryInterface', () => {
it('should create a tooltip', () => {
fixtureEl.innerHTML = '
'
const div = fixtureEl.querySelector('div')
- jQueryMock.fn.tooltip = Tooltip._jQueryInterface
+ jQueryMock.fn.tooltip = Tooltip.jQueryInterface
jQueryMock.elements = [div]
jQueryMock.fn.tooltip.call(jQueryMock)
- expect(Tooltip._getInstance(div)).toBeDefined()
+ expect(Tooltip.getInstance(div)).toBeDefined()
})
it('should not re create a tooltip', () => {
@@ -946,12 +946,12 @@ describe('Tooltip', () => {
const div = fixtureEl.querySelector('div')
const tooltip = new Tooltip(div)
- jQueryMock.fn.tooltip = Tooltip._jQueryInterface
+ jQueryMock.fn.tooltip = Tooltip.jQueryInterface
jQueryMock.elements = [div]
jQueryMock.fn.tooltip.call(jQueryMock)
- expect(Tooltip._getInstance(div)).toEqual(tooltip)
+ expect(Tooltip.getInstance(div)).toEqual(tooltip)
})
it('should call a tooltip method', () => {
@@ -962,12 +962,12 @@ describe('Tooltip', () => {
spyOn(tooltip, 'show')
- jQueryMock.fn.tooltip = Tooltip._jQueryInterface
+ jQueryMock.fn.tooltip = Tooltip.jQueryInterface
jQueryMock.elements = [div]
jQueryMock.fn.tooltip.call(jQueryMock, 'show')
- expect(Tooltip._getInstance(div)).toEqual(tooltip)
+ expect(Tooltip.getInstance(div)).toEqual(tooltip)
expect(tooltip.show).toHaveBeenCalled()
})
@@ -978,7 +978,7 @@ describe('Tooltip', () => {
spyOn(Tooltip.prototype, 'dispose')
- jQueryMock.fn.tooltip = Tooltip._jQueryInterface
+ jQueryMock.fn.tooltip = Tooltip.jQueryInterface
jQueryMock.elements = [div]
jQueryMock.fn.tooltip.call(jQueryMock, 'dispose')
@@ -992,7 +992,7 @@ describe('Tooltip', () => {
const div = fixtureEl.querySelector('div')
const action = 'undefinedMethod'
- jQueryMock.fn.tooltip = Tooltip._jQueryInterface
+ jQueryMock.fn.tooltip = Tooltip.jQueryInterface
jQueryMock.elements = [div]
try {
diff --git a/js/tests/README.md b/js/tests/README.md
index 3a01d33997..76a582e855 100644
--- a/js/tests/README.md
+++ b/js/tests/README.md
@@ -32,10 +32,10 @@ Currently we're aiming for at least 90% test coverage for our code. To ensure yo
```js
// Synchronous test
-describe('_getInstance', () => {
+describe('getInstance', () => {
it('should return null if there is no instance', () => {
// Make assertion
- expect(Tab._getInstance(fixtureEl)).toEqual(null)
+ expect(Tab.getInstance(fixtureEl)).toEqual(null)
})
it('should return this instance', () => {
@@ -45,7 +45,7 @@ describe('_getInstance', () => {
const tab = new Tab(divEl)
// Make assertion
- expect(Tab._getInstance(divEl)).toEqual(tab)
+ expect(Tab.getInstance(divEl)).toEqual(tab)
})
})
diff --git a/js/tests/visual/toast.html b/js/tests/visual/toast.html
index 21ecbac92c..1dd1fe3fbd 100644
--- a/js/tests/visual/toast.html
+++ b/js/tests/visual/toast.html
@@ -67,7 +67,7 @@
document.getElementById('btnShowToast').addEventListener('click', function () {
Array.from(document.querySelectorAll('.toast'))
.forEach(function (toastNode) {
- var toast = Toast._getInstance(toastNode)
+ var toast = Toast.getInstance(toastNode)
toast.show()
})
})
@@ -75,7 +75,7 @@
document.getElementById('btnHideToast').addEventListener('click', function () {
Array.from(document.querySelectorAll('.toast'))
.forEach(function (toastNode) {
- var toast = Toast._getInstance(toastNode)
+ var toast = Toast.getInstance(toastNode)
toast.hide()
})
})
diff --git a/site/content/docs/4.3/components/alerts.md b/site/content/docs/4.3/components/alerts.md
index 2f00b37593..9a283c7542 100644
--- a/site/content/docs/4.3/components/alerts.md
+++ b/site/content/docs/4.3/components/alerts.md
@@ -133,10 +133,10 @@ This makes an alert listen for click events on descendant elements which have th
- _getInstance
+ getInstance
- Static method which allows you to get the alert instance associated to a DOM element, you can use it like this: bootstrap.Alert._getInstance(alert)
+ Static method which allows you to get the alert instance associated to a DOM element, you can use it like this: bootstrap.Alert.getInstance(alert)
@@ -144,7 +144,7 @@ This makes an alert listen for click events on descendant elements which have th
{{< highlight js >}}
var alertNode = document.querySelector('.alert')
-var alert = bootstrap.Alert._getInstance(alertNode)
+var alert = bootstrap.Alert.getInstance(alertNode)
alert.close()
{{< /highlight >}}
diff --git a/site/content/docs/4.3/components/carousel.md b/site/content/docs/4.3/components/carousel.md
index 300c42cef7..02eedb4abf 100644
--- a/site/content/docs/4.3/components/carousel.md
+++ b/site/content/docs/4.3/components/carousel.md
@@ -329,7 +329,7 @@ var carousel = new bootstrap.Carousel(myCarousel, {
Destroys an element's carousel.
- _getInstance
+ getInstance
Static method which allows you to get the carousel instance associated with a DOM element.
diff --git a/site/content/docs/4.3/components/collapse.md b/site/content/docs/4.3/components/collapse.md
index 5b8dc5ea19..369a31b4a8 100644
--- a/site/content/docs/4.3/components/collapse.md
+++ b/site/content/docs/4.3/components/collapse.md
@@ -227,7 +227,7 @@ var bsCollapse = new bootstrap.Collapse(myCollapse, {
Destroys an element's collapse.
- _getInstance
+ getInstance
Static method which allows you to get the collapse instance associated with a DOM element.
diff --git a/site/content/docs/4.3/components/dropdowns.md b/site/content/docs/4.3/components/dropdowns.md
index 8f4e914c71..42bc1bb56c 100644
--- a/site/content/docs/4.3/components/dropdowns.md
+++ b/site/content/docs/4.3/components/dropdowns.md
@@ -901,7 +901,7 @@ Note when `boundary` is set to any value other than `'scrollParent'`, the style
- _getInstance
+ getInstance
Static method which allows you to get the dropdown instance associated with a DOM element.
diff --git a/site/content/docs/4.3/components/modal.md b/site/content/docs/4.3/components/modal.md
index 539d70b3d8..8accb6cdea 100644
--- a/site/content/docs/4.3/components/modal.md
+++ b/site/content/docs/4.3/components/modal.md
@@ -820,13 +820,13 @@ Destroys an element's modal.
{{< highlight js >}}myModal.dispose(){{< /highlight >}}
-#### _getInstance
+#### getInstance
*Static* method which allows you to get the modal instance associated with a DOM element
{{< highlight js >}}
var myModalEl = document.getElementById('myModal')
-var modal = bootstrap.Modal._getInstance(myModalEl) // Returns a Bootstrap modal instance
+var modal = bootstrap.Modal.getInstance(myModalEl) // Returns a Bootstrap modal instance
{{< /highlight >}}
### Events
diff --git a/site/content/docs/4.3/components/popovers.md b/site/content/docs/4.3/components/popovers.md
index aa2f11883b..dfd4904e06 100644
--- a/site/content/docs/4.3/components/popovers.md
+++ b/site/content/docs/4.3/components/popovers.md
@@ -345,13 +345,13 @@ Updates the position of an element's popover.
{{< highlight js >}}myPopover.update(){{< /highlight >}}
-#### _getInstance
+#### getInstance
*Static* method which allows you to get the popover instance associated with a DOM element
{{< highlight js >}}
var exampleTriggerEl = document.getElementById('example')
-var popover = bootstrap.Popover._getInstance(exampleTriggerEl) // Returns a Bootstrap popover instance
+var popover = bootstrap.Popover.getInstance(exampleTriggerEl) // Returns a Bootstrap popover instance
{{< /highlight >}}
### Events
diff --git a/site/content/docs/4.3/getting-started/javascript.md b/site/content/docs/4.3/getting-started/javascript.md
index 4c4ccc7315..d4c0060947 100644
--- a/site/content/docs/4.3/getting-started/javascript.md
+++ b/site/content/docs/4.3/getting-started/javascript.md
@@ -75,7 +75,7 @@ var modal = new bootstrap.Modal(myModalEl) // initialized with defaults
var modal = new bootstrap.Modal(myModalEl, { keyboard: false }) // initialized with no keyboard
{{< /highlight >}}
-If you'd like to get a particular plugin instance, each plugin exposes a `_getInstance` method. In order to retrieve it directly from an element, do this: `bootstrap.Popover._getInstance(myPopoverEl)`.
+If you'd like to get a particular plugin instance, each plugin exposes a `getInstance` method. In order to retrieve it directly from an element, do this: `bootstrap.Popover.getInstance(myPopoverEl)`.
### Asynchronous functions and transitions
@@ -95,7 +95,7 @@ In addition a method call on a **transitioning component will be ignored**.
{{< highlight js >}}
var myCarouselEl = document.getElementById('myCarousel')
-var carousel = bootstrap.Carousel._getInstance(myCarouselEl) // Retrieve a Carousel instance
+var carousel = bootstrap.Carousel.getInstance(myCarouselEl) // Retrieve a Carousel instance
myCarouselEl.addEventListener('slid.bs.carousel', function (e) {
carousel.to('2') // Will slide to the slide 2 as soon as the transition to slide 1 is finished
diff --git a/site/static/docs/4.3/assets/js/src/application.js b/site/static/docs/4.3/assets/js/src/application.js
index 3a1505b718..151261a2b2 100644
--- a/site/static/docs/4.3/assets/js/src/application.js
+++ b/site/static/docs/4.3/assets/js/src/application.js
@@ -142,7 +142,7 @@
})
clipboard.on('success', function (e) {
- var tooltipBtn = bootstrap.Tooltip._getInstance(e.trigger)
+ var tooltipBtn = bootstrap.Tooltip.getInstance(e.trigger)
e.trigger.setAttribute('data-original-title', 'Copied!')
tooltipBtn.show()
@@ -154,7 +154,7 @@
clipboard.on('error', function (e) {
var modifierKey = /Mac/i.test(navigator.userAgent) ? '\u2318' : 'Ctrl-'
var fallbackMsg = 'Press ' + modifierKey + 'C to copy'
- var tooltipBtn = bootstrap.Tooltip._getInstance(e.trigger)
+ var tooltipBtn = bootstrap.Tooltip.getInstance(e.trigger)
e.trigger.setAttribute('title', fallbackMsg)
tooltipBtn._fixTitle()