Don't remove whole head when appending a stylesheet for a plugin (#1092)

This commit is contained in:
AStove 2019-12-16 11:08:06 +01:00 committed by Lorenz Hübschle-Schneider
parent a61bf6832d
commit 47c0a5a093
1 changed files with 4 additions and 2 deletions

View File

@ -463,8 +463,10 @@ plugins.factory('userPlugins', function() {
jsonp(url, function(data) {
// Add the gist stylesheet only once
if (document.querySelectorAll('link[rel=stylesheet][href="' + data.stylesheet + '"]').length < 1) {
var stylesheet = '<link rel="stylesheet" href="' + data.stylesheet + '"></link>';
document.getElementsByTagName('head')[0].innerHTML += stylesheet;
var stylesheet = document.createElement("link");
stylesheet.href = data.stylesheet;
stylesheet.setAttribute('rel', 'stylesheet');
document.head.appendChild(stylesheet);
}
element.innerHTML = '<div style="clear:both">' + data.div + '</div>';
});