1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-07 11:22:38 +01:00

code review e7294a46d4: force refresh tooltip if needed

This commit is contained in:
gorhill 2017-11-07 17:03:24 -05:00
parent e7294a46d4
commit 9884ff115a
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -505,7 +505,7 @@ var renderPopup = function() {
// https://github.com/gorhill/uBlock/issues/2889
// Use tooltip for ARIA purpose.
var renderTooltips = function() {
var renderTooltips = function(selector) {
var elem = uDom.nodeFromId('switch'),
off = document.body.classList.contains('off'),
text;
@ -518,6 +518,10 @@ var renderTooltips = function() {
elem.setAttribute('aria-label', text);
elem.setAttribute('data-tip', text);
}
if ( typeof selector === 'string' ) {
uDom.nodeFromId('tooltip').textContent =
uDom.nodeFromSelector(selector).getAttribute('data-tip');
}
};
/******************************************************************************/
@ -621,7 +625,7 @@ var toggleNetFilteringSwitch = function(ev) {
tabId: popupData.tabId
}
);
renderTooltips();
renderTooltips('#switch');
hashFromPopupData();
};