use optional chaining

This commit is contained in:
Matt Bierner
2020-09-11 14:25:47 -07:00
parent 3e71592258
commit 8a6b38e4ef

View File

@@ -784,11 +784,11 @@ function getSharedStyleSheet(): HTMLStyleElement {
}
function getDynamicStyleSheetRules(style: any) {
if (style && style.sheet && style.sheet.rules) {
if (style?.sheet?.rules) {
// Chrome, IE
return style.sheet.rules;
}
if (style && style.sheet && style.sheet.cssRules) {
if (style?.sheet?.cssRules) {
// FF
return style.sheet.cssRules;
}