A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/bootstrap-vue/bootstrap-vue/commit/5363a3132df898cb5f0cac172c0510aead62d66e below:

hide the tooltip when the title is set to empty (clo… · bootstrap-vue/bootstrap-vue@5363a31 · GitHub

@@ -56,6 +56,9 @@ const CONTAINER_SELECTOR = [MODAL_SELECTOR, SIDEBAR_SELECTOR].join(', ')

56 56

const DROPDOWN_CLASS = 'dropdown'

57 57

const DROPDOWN_OPEN_SELECTOR = '.dropdown-menu.show'

58 58 59 +

// Data attribute to temporary store the `title` attribute's value

60 +

const DATA_TITLE_ATTR = 'data-original-title'

61 + 59 62

// Data specific to popper and template

60 63

// We don't use props, as we need reactivity (we can't pass reactive props)

61 64

const templateData = {

@@ -200,8 +203,18 @@ export const BVTooltip = /*#__PURE__*/ Vue.extend({

200 203

// ensure that the template updates accordingly

201 204

this.handleTemplateUpdate()

202 205

},

203 -

disabled(newVal) {

204 -

newVal ? this.disable() : this.enable()

206 +

title(newValue, oldValue) {

207 +

// Make sure to hide the tooltip when the title is set empty

208 +

if (newValue !== oldValue && !newValue) {

209 +

this.hide()

210 +

}

211 +

},

212 +

disabled(newValue) {

213 +

if (newValue) {

214 +

this.disable()

215 +

} else {

216 +

this.enable()

217 +

}

205 218

}

206 219

},

207 220

created() {

@@ -272,10 +285,10 @@ export const BVTooltip = /*#__PURE__*/ Vue.extend({

272 285

}

273 286

}

274 287

})

288 +

// If the title has updated, we may need to handle the `title`

289 +

// attribute on the trigger target

290 +

// We only do this while the template is open

275 291

if (titleUpdated && this.localShow) {

276 -

// If the title has updated, we may need to handle the title

277 -

// attribute on the trigger target. We only do this while the

278 -

// template is open

279 292

this.fixTitle()

280 293

}

281 294

},

@@ -594,22 +607,19 @@ export const BVTooltip = /*#__PURE__*/ Vue.extend({

594 607

}

595 608

},

596 609

fixTitle() {

597 -

// If the target has a title attribute, null it out and

598 -

// store on data-title

610 +

// If the target has a `title` attribute, remove it and store it on a data attribute

599 611

const target = this.getTarget()

600 -

if (target && getAttr(target, 'title')) {

601 -

// We only update title attribute if it has a value

602 -

setAttr(target, 'data-original-title', getAttr(target, 'title') || '')

612 +

if (target && hasAttr(target, 'title')) {

613 +

setAttr(target, DATA_TITLE_ATTR, getAttr(target, 'title') || '')

603 614

setAttr(target, 'title', '')

604 615

}

605 616

},

606 617

restoreTitle() {

607 -

// If target had a title, restore the title attribute

608 -

// and remove the data-title attribute

618 +

// If the target had a title, restore it and remove the data attribute

609 619

const target = this.getTarget()

610 -

if (target && hasAttr(target, 'data-original-title')) {

611 -

setAttr(target, 'title', getAttr(target, 'data-original-title') || '')

612 -

removeAttr(target, 'data-original-title')

620 +

if (target && hasAttr(target, DATA_TITLE_ATTR)) {

621 +

setAttr(target, 'title', getAttr(target, DATA_TITLE_ATTR) || '')

622 +

removeAttr(target, DATA_TITLE_ATTR)

613 623

}

614 624

},

615 625

// --- BvEvent helpers ---


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4