This commit is contained in:
2021-09-05 20:17:36 +03:00
parent 7310d04755
commit 6297c67201
28 changed files with 2676 additions and 1591 deletions
+8 -7
View File
@@ -25,9 +25,9 @@ kit.PluginManager.register('tooltip',function(module, exports, require){
*/
const NAME = 'tooltip'
const DATA_KEY = 'kit.tooltip'
const DATA_KEY = 'bs.tooltip'
const EVENT_KEY = `.${DATA_KEY}`
const CLASS_PREFIX = 'kit-tooltip'
const CLASS_PREFIX = 'bs-tooltip'
const BSCLS_PREFIX_REGEX = new RegExp(`(^|\\s)${CLASS_PREFIX}\\S+`, 'g')
const DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn'])
@@ -62,7 +62,7 @@ kit.PluginManager.register('tooltip',function(module, exports, require){
const Default = {
animation: true,
template: '<div class="tooltip" role="tooltip">' +
'<div class="tooltip-arrow"></div>' +
'<div class="tooltip-arrow" data-popper-arrow="true"></div>' +
'<div class="tooltip-inner"></div>' +
'</div>',
trigger: 'hover focus',
@@ -76,7 +76,7 @@ kit.PluginManager.register('tooltip',function(module, exports, require){
fallbackPlacements: ['top', 'right', 'bottom', 'left'],
boundary: 'clippingParents',
customClass: '',
sanitize: true,
sanitize: false,
sanitizeFn: null,
allowList: DefaultAllowlist,
popperConfig: null
@@ -115,6 +115,7 @@ kit.PluginManager.register('tooltip',function(module, exports, require){
* ------------------------------------------------------------------------
*/
/** @class kitTooltip */
class Tooltip extends BaseComponent {
constructor(element, config) {
if (typeof Popper === 'undefined') {
@@ -405,7 +406,7 @@ kit.PluginManager.register('tooltip',function(module, exports, require){
}
getTitle() {
let title = this._element.getAttribute('data-kit-original-title')
let title = this._element.getAttribute('data-bs-original-title')
if (!title) {
title = typeof this._config.title === 'function' ?
@@ -552,10 +553,10 @@ kit.PluginManager.register('tooltip',function(module, exports, require){
_fixTitle() {
const title = this._element.getAttribute('title')
const originalTitleType = typeof this._element.getAttribute('data-kit-original-title')
const originalTitleType = typeof this._element.getAttribute('data-bs-original-title')
if (title || originalTitleType !== 'string') {
this._element.setAttribute('data-kit-original-title', title || '')
this._element.setAttribute('data-bs-original-title', title || '')
if (title && !this._element.getAttribute('aria-label') && !this._element.textContent) {
this._element.setAttribute('aria-label', title)
}