Bug 1516287 - Wait for stylesheet to load before adding category colours. r=philipp
This commit is contained in:
Родитель
5e708c91f1
Коммит
f991c45521
|
@ -463,9 +463,16 @@ var categoryManagement = {
|
|||
// We haven't created a rule for this category yet, do so now.
|
||||
let sheet = getViewStyleSheet();
|
||||
let ruleString = '.category-color-box[categories~="' + aCatName + '"] {} ';
|
||||
let ruleIndex = sheet.insertRule(ruleString, sheet.cssRules.length);
|
||||
|
||||
this.categoryStyleCache[aCatName] = sheet.cssRules[ruleIndex];
|
||||
try {
|
||||
let ruleIndex = sheet.insertRule(ruleString, sheet.cssRules.length);
|
||||
this.categoryStyleCache[aCatName] = sheet.cssRules[ruleIndex];
|
||||
} catch (ex) {
|
||||
sheet.ownerNode.addEventListener("load",
|
||||
() => this.updateStyleSheetForCategory(aCatName),
|
||||
{ once: true });
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
let color = Preferences.get("calendar.category.color." + aCatName) || "";
|
||||
|
|
Загрузка…
Ссылка в новой задаче