mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-11 16:14:04 +02:00
Tooltip: refactor jQueryInterface
This commit is contained in:
@@ -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]()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user