Created
December 17, 2014 17:37
-
-
Save RenatoUtsch/f344ecb4eb682b8bb0aa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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