Commit dd0b300a authored by Kushal Pandya's avatar Kushal Pandya

Merge branch '249784-replace-bs-tooltip-main-js' into 'master'

Replace jQuery tooltip api calls with tooltips facade in main.js

Closes #249784

See merge request gitlab-org/gitlab!43908
parents 8a347092 f009edbb
......@@ -39,6 +39,8 @@ import initPersistentUserCallouts from './persistent_user_callouts';
import { initUserTracking, initDefaultTrackers } from './tracking';
import { __ } from './locale';
import * as tooltips from '~/tooltips';
import 'ee_else_ce/main_ee';
applyGitLabUIConfig();
......@@ -77,7 +79,7 @@ document.addEventListener('beforeunload', () => {
// Unbind scroll events
$(document).off('scroll');
// Close any open tooltips
$('.has-tooltip, [data-toggle="tooltip"]').tooltip('dispose');
tooltips.dispose(document.querySelectorAll('.has-tooltip, [data-toggle="tooltip"]'));
// Close any open popover
$('[data-toggle="popover"]').popover('dispose');
});
......@@ -133,8 +135,10 @@ function deferredInitialisation() {
addSelectOnFocusBehaviour('.js-select-on-focus');
$('.remove-row').on('ajax:success', function removeRowAjaxSuccessCallback() {
tooltips.dispose(this);
// eslint-disable-next-line no-jquery/no-fade
$(this)
.tooltip('dispose')
.closest('li')
.fadeOut();
});
......@@ -154,7 +158,7 @@ function deferredInitialisation() {
const delay = glTooltipDelay ? JSON.parse(glTooltipDelay) : 0;
// Initialize tooltips
$body.tooltip({
tooltips.initTooltips({
selector: '.has-tooltip, [data-toggle="tooltip"]',
trigger: 'hover',
boundary: 'viewport',
......
......@@ -58,6 +58,8 @@ const applyToElements = (elements, handler) => toArray(elements).forEach(handler
const invokeBootstrapApi = (elements, method) => {
if (isFunction(elements.tooltip)) {
elements.tooltip(method);
} else {
jQuery(elements).tooltip(method);
}
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment