HTML Tree: make tooltip setting code use any parent xul node

This commit is contained in:
Adomas Venčkauskas 2022-02-04 14:18:53 +02:00
parent c78bf1b2a3
commit 54ad6da1af

View file

@ -997,7 +997,11 @@ class VirtualizedTable extends React.Component {
*/ */
_setXulTooltip() { _setXulTooltip() {
// Make sure container xul element has a tooltip set // Make sure container xul element has a tooltip set
let xulElem = this._topDiv.closest('.virtualized-table-container'); let xulElem = this._topDiv;
while (xulElem && xulElem.namespaceURI !== "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul") {
xulElem = xulElem.parentElement;
}
if (!xulElem) return;
if (xulElem.getAttribute('tooltip') != 'html-tooltip') { if (xulElem.getAttribute('tooltip') != 'html-tooltip') {
xulElem.setAttribute('tooltip', 'html-tooltip'); xulElem.setAttribute('tooltip', 'html-tooltip');
} }
@ -1008,6 +1012,7 @@ class VirtualizedTable extends React.Component {
let tooltipTitleNode = document.tooltipNode.closest('div *[title], iframe *[title], browser *[title]'); let tooltipTitleNode = document.tooltipNode.closest('div *[title], iframe *[title], browser *[title]');
if (document.tooltipNode && tooltipTitleNode) { if (document.tooltipNode && tooltipTitleNode) {
this.setAttribute('label', tooltipTitleNode.getAttribute('title')); this.setAttribute('label', tooltipTitleNode.getAttribute('title'));
return;
} }
e.preventDefault(); e.preventDefault();
}); });