Last active
September 13, 2015 02:31
Revisions
-
wwayne revised this gist
Sep 13, 2015 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,12 +1,15 @@ import cssStyle from './style' componentWillUnmount () { // delete the style when the component unmount let tag = document.querySelector('style[id="react-tooltip"]') document.getElementsByTagName('head')[0].removeChild(tag) } render() { // to check if the style has been existed if (!document.getElementsByTagName('head')[0].querySelector('style[id="react-tooltip"]')) { // insert the style into the head let tag = document.createElement('style') tag.id = 'react-tooltip' tag.innerHTML = cssStyle -
wwayne renamed this gist
Sep 13, 2015 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
wwayne created this gist
Sep 13, 2015 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ import cssStyle from './style' componentWillUnmount () { let tag = document.querySelector('style[id="react-tooltip"]') document.getElementsByTagName('head')[0].removeChild(tag) } render() { if (!document.getElementsByTagName('head')[0].querySelector('style[id="react-tooltip"]')) { let tag = document.createElement('style') tag.id = 'react-tooltip' tag.innerHTML = cssStyle document.getElementsByTagName('head')[0].appendChild(tag) } return (...) }