Merge pull request #739 from rachel-fenichel/bugfix/move_css

Move injected css to start of head
This commit is contained in:
Rachel Fenichel
2016-11-09 13:14:21 -08:00
committed by GitHub

View File

@@ -84,9 +84,10 @@ Blockly.Css.inject = function(hasCss, pathToMedia) {
// Strip off any trailing slash (either Unix or Windows).
Blockly.Css.mediaPath_ = pathToMedia.replace(/[\\\/]$/, '');
text = text.replace(/<<<PATH>>>/g, Blockly.Css.mediaPath_);
// Inject CSS tag.
// Inject CSS tag at start of head.
var cssNode = document.createElement('style');
document.head.appendChild(cssNode);
document.head.insertBefore(cssNode, document.head.firstChild);
var cssTextNode = document.createTextNode(text);
cssNode.appendChild(cssTextNode);
Blockly.Css.styleSheet_ = cssNode.sheet;