mirror of
https://github.com/google/blockly.git
synced 2026-01-08 01:20:12 +01:00
Merge pull request #739 from rachel-fenichel/bugfix/move_css
Move injected css to start of head
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user