Closed
Description
I wrote this behavior for adding themes but when I use the /deep/ combinator for the var selectorText it thows an error :
var css_style = {
style_sheet_utility: function () {
return {
create_style_sheet: function (href) {
if (typeof href !== 'undefined') {
var element: any = document.createElement('link');
element.type = 'text/css';
element.rel = 'stylesheet';
element.href = href;
}
else {
var element: any = document.createElement('style');
element.type = 'text/css';
}
document.getElementsByTagName('head')[0].appendChild(element);
var sheet: any = document.styleSheets[document.styleSheets.length - 1];
if (typeof sheet.addRule === 'undefined')
sheet.addRule = this.add_rule;
if (typeof sheet.removeRule === 'undefined')
sheet.removeRule = sheet.deleteRule;
return sheet;
},
add_rule: function (selectorText, cssText, index) {
if (typeof index === 'undefined')
index = this.cssRules.length;
this.insertRule(selectorText + ' {' + cssText + '}', index);
}
};
}
};
SyntaxError: An invalid or illegal string was specified
this.insertRule(selectorText + ' {' + cssText + '}', index);
Metadata
Assignees
Labels
No labels