mirror of
https://github.com/twbs/bootstrap.git
synced 2025-02-25 04:12:55 +01:00
Tooltip: refactor jQueryInterface
This commit is contained in:
parent
a5945369bd
commit
53c77c0203
@ -94,13 +94,15 @@ class Popover extends Tooltip {
|
|||||||
return this.each(function () {
|
return this.each(function () {
|
||||||
const data = Popover.getOrCreateInstance(this, config)
|
const data = Popover.getOrCreateInstance(this, config)
|
||||||
|
|
||||||
if (typeof config === 'string') {
|
if (typeof config !== 'string') {
|
||||||
if (typeof data[config] === 'undefined') {
|
return
|
||||||
throw new TypeError(`No method named "${config}"`)
|
|
||||||
}
|
|
||||||
|
|
||||||
data[config]()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof data[config] === 'undefined') {
|
||||||
|
throw new TypeError(`No method named "${config}"`)
|
||||||
|
}
|
||||||
|
|
||||||
|
data[config]()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -637,13 +637,15 @@ class Tooltip extends BaseComponent {
|
|||||||
return this.each(function () {
|
return this.each(function () {
|
||||||
const data = Tooltip.getOrCreateInstance(this, config)
|
const data = Tooltip.getOrCreateInstance(this, config)
|
||||||
|
|
||||||
if (typeof config === 'string') {
|
if (typeof config !== 'string') {
|
||||||
if (typeof data[config] === 'undefined') {
|
return
|
||||||
throw new TypeError(`No method named "${config}"`)
|
|
||||||
}
|
|
||||||
|
|
||||||
data[config]()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof data[config] === 'undefined') {
|
||||||
|
throw new TypeError(`No method named "${config}"`)
|
||||||
|
}
|
||||||
|
|
||||||
|
data[config]()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user