Bug 1516287 - Wait for stylesheet to load before adding category colours. r=philipp

This commit is contained in:
Geoff Lankow 2018-12-26 10:55:59 +13:00
Родитель 5e708c91f1
Коммит f991c45521
1 изменённых файлов: 9 добавлений и 2 удалений

Просмотреть файл

@ -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) || "";