Skip to content

Commit

Permalink
Update for IE when appending new styles.
Browse files Browse the repository at this point in the history
Keeps existing styles for IE7-10 when appending new styles.
  • Loading branch information
Envoid committed Oct 20, 2014
1 parent c85cea0 commit e1fa01f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions jquery.injectCSS.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,16 @@
});
}

var containerDomElem = container[0];
var isIeStylesheet = containerDomElem.styleSheet !== undefined && containerDomElem.styleSheet.cssText !== undefined;

var css = "";
if (!options.truncateFirst) {
css += container.text();
css += isIeStylesheet ? containerDomElem.styleSheet.cssText : container.text();
}
css += toCSS(jss, options);

var containerDomElem = container[0];
if (containerDomElem.styleSheet !== undefined && containerDomElem.styleSheet.cssText !== undefined) { // IE
if (isIeStylesheet) {
containerDomElem.styleSheet.cssText = css;
} else {
container.text(css); //Others
Expand Down

0 comments on commit e1fa01f

Please sign in to comment.