[go: up one dir, main page]

Utility method to update jQuery bootstrap tooltips instead of using `_fixTitle`

What

Create utility method for updating tooltip, which would then call through to .tooltip('_fixTitle').

Why

Make more clear what is being done, provide a single place to update if this needs to change in the future and a reduce where we need to require jQuery.

Related

Discussion in https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/5622#note_106531319 (+7 comments):

in this case we will have no other option but to stick with jQuery here I guess one way we could isolate the jQuery would be to create an updateBootstrapTooltip function and import that here instead.

export const updateBootstrapTooltip = (element, value) => {
  element.setAttribute('title', value);
  $(element).tooltip('_fixTitle');
};

If that sounds worthwhile we could create an issue and replace other uses of fixTitle with this.