It appears, from some research that the data-trigger attribute is ignored when using the selector property for initialising popovers. You therefore can’t use per-element options when initialising this way.
You can get around it by having a separate initialisation for each trigger by being more specific with selectors:
document.addEventListener('DOMContentLoaded', function (event) {
return new bootstrap.Popover(document.body, {
selector: '[popover-title][data-trigger="hover"], [data-bs-content][data-trigger="hover"]',
placement: function (node) {
var pexpression = node.getAttribute('dmx-bs-placement') || '';
return dmx.parse(pexpression) || node.getAttribute('data-bs-placement') || 'auto';
},
title: function () {
return this.getAttribute('popover-title') || this.getAttribute('title') || '';
},
content: function () {
var expression = this.getAttribute('dmx-bs-popover') || '';
return dmx.parse(expression) || this.getAttribute('data-bs-content') || '';
},
trigger: "hover"
});
});
document.addEventListener('DOMContentLoaded', function (event) {
return new bootstrap.Popover(document.body, {
selector: '[popover-title][data-trigger="focus"], [data-bs-content][data-trigger="focus"]',
placement: function (node) {
var pexpression = node.getAttribute('dmx-bs-placement') || '';
return dmx.parse(pexpression) || node.getAttribute('data-bs-placement') || 'auto';
},
title: function () {
return this.getAttribute('popover-title') || this.getAttribute('title') || '';
},
content: function () {
var expression = this.getAttribute('dmx-bs-popover') || '';
return dmx.parse(expression) || this.getAttribute('data-bs-content') || '';
},
trigger: "focus"
});
});
document.addEventListener('DOMContentLoaded', function (event) {
return pocresult = new bootstrap.Popover(document.body, {
selector: '[popover-title][data-trigger!="hover"][data-trigger!="focus"], [data-bs-content][data-trigger!="hover"][data-trigger!="focus"]',
placement: function (node) {
var pexpression = node.getAttribute('dmx-bs-placement') || '';
return dmx.parse(pexpression) || node.getAttribute('data-bs-placement') || 'auto';
},
title: function () {
return this.getAttribute('popover-title') || this.getAttribute('title') || '';
},
content: function () {
var expression = this.getAttribute('dmx-bs-popover') || '';
return dmx.parse(expression) || this.getAttribute('data-bs-content') || '';
},
trigger: "click"
});
});
You’re far cleverer compared with me so you might have a brilliant solution. Alternatively, maybe just remove the options to choose trigger when adding a popover and leave it just as click?