Skip to content

Instantly share code, notes, and snippets.

@RenatoUtsch
Created December 17, 2014 17:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RenatoUtsch/f344ecb4eb682b8bb0aa to your computer and use it in GitHub Desktop.
Save RenatoUtsch/f344ecb4eb682b8bb0aa to your computer and use it in GitHub Desktop.
/*
* Replace the original nv.toltip.cleanup function to fix shadow DOM issues.
* This is based on naunga's work at https://github.com/naunga/polychart-element
* I do not submit this as a pull request to nvd3 because it needs shadow DOM
* support or polyfill to work correctly, what nvd3 doesn't use.
**/
(function(){
nv.tooltip.cleanup = function() {
// Find the tooltips, mark them for removal by this class (so others cleanups won't find it)
var tooltips = document.querySelectorAll('body /deep/ .nvtooltip');
var purging = [];
for(var i = 0; i < tooltips.length; ++i) {
purging.push(tooltips[i]);
tooltips[i].style.transitionDelay = '0 !important';
tooltips[i].style.opacity = 0;
tooltips[i].className = 'nvtooltip-pending-removal';
}
setTimeout(function() {
while (purging.length) {
var removeMe = purging.pop();
removeMe.parentNode.removeChild(removeMe);
}
}, 500);
};
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment