app/javascript/avo.base.js in avo-3.12.0 vs app/javascript/avo.base.js in avo-3.13.0
- old
+ new
@@ -45,10 +45,15 @@
content(reference) {
const title = reference.getAttribute('title')
reference.removeAttribute('title')
reference.removeAttribute('data-tippy')
+ // Identify elements that have tippy tooltip with the has-data-tippy attribute
+ // Store the title on the attribute
+ // Used to revert data-tippy and title attributes before cache
+ reference.setAttribute('has-data-tippy', title)
+
return title
},
onShow(tooltipInstance) {
// Don't render tooltip if there is no content.
if (tooltipInstance.props.content === null || tooltipInstance.props.content.length === 0) {
@@ -107,9 +112,16 @@
})
document.addEventListener('turbo:submit-start', () => document.body.classList.add('turbo-loading'))
document.addEventListener('turbo:submit-end', () => document.body.classList.remove('turbo-loading'))
document.addEventListener('turbo:before-cache', () => {
document.querySelectorAll('[data-turbo-remove-before-cache]').forEach((element) => element.remove())
+
+ // Revert data-tippy and title attributes stored on the has-data-tippy attribute
+ document.querySelectorAll('[has-data-tippy]').forEach((element) => {
+ element.setAttribute('data-tippy', 'tooltip')
+ element.setAttribute('title', element.getAttribute('has-data-tippy'))
+ element.removeAttribute('has-data-tippy')
+ })
})
window.Avo = window.Avo || { configuration: {} }
window.Avo.menus = {