Apply stylesheets client-side in a safer manner.

This commit is contained in:
Max Goodman
2012-09-14 16:36:30 -07:00
parent 5dba8a65ae
commit 7621afe962

View File

@@ -667,8 +667,10 @@ $.apply_stylesheet = function(cssText) {
* that has the old stylesheet, and delete it. Then we add a
* <style> with the new one */
$("head").children('*[title="' + sheet_title + '"]').remove();
$("head").append("<style type='text/css' media='screen' title='" +
sheet_title + "'>" + cssText + "</style>");
var stylesheet = $('<style type="text/css" media="screen"></style>')
.attr('title', sheet_title)
.text(cssText)
.appendTo('head')
}
};