From efe181a207a2195845443551ab401940b9ccc2d9 Mon Sep 17 00:00:00 2001 From: Robert Lange Date: Fri, 19 May 2017 15:05:55 +0200 Subject: [PATCH] insert css as first to allow easy css styling without important --- src/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index 21cad77dc..59a911994 100644 --- a/src/index.js +++ b/src/index.js @@ -407,11 +407,12 @@ class ReactTooltip extends Component { * in this way we can insert default css */ setStyleHeader () { - if (!document.getElementsByTagName('head')[0].querySelector('style[id="react-tooltip"]')) { + const head = document.getElementsByTagName('head')[0] + if (!head.querySelector('style[id="react-tooltip"]')) { let tag = document.createElement('style') tag.id = 'react-tooltip' tag.innerHTML = cssStyle - document.getElementsByTagName('head')[0].appendChild(tag) + head.insertBefore(tag, head.firstChild) } }