Merge pull request #2559 from DSpace/backport-2558-to-dspace-7_x

[Port dspace-7_x] Revert 2454 "Check cssRules before css variables are read from stylesheet"
This commit is contained in:
Tim Donohue
2023-10-20 12:07:43 -05:00
committed by GitHub

View File

@@ -26,15 +26,6 @@ export class CSSVariableService {
return styleSheet.href.indexOf(window.location.origin) === 0;
};
/**
* Checks whether the specific stylesheet object has the property cssRules
* @param styleSheet The stylesheet
*/
hasCssRules = (styleSheet) => {
// Injected styles might have no css rules value
return styleSheet.hasOwnProperty('cssRules') && styleSheet.cssRules;
};
/*
Determine if the given rule is a CSSStyleRule
See: https://developer.mozilla.org/en-US/docs/Web/API/CSSRule#Type_constants
@@ -102,10 +93,8 @@ export class CSSVariableService {
if (isNotEmpty(document.styleSheets)) {
// styleSheets is array-like, so we convert it to an array.
// Filter out any stylesheets not on this domain
// Filter out any stylesheets that have no cssRules property
return [...document.styleSheets]
.filter(this.isSameDomain)
.filter(this.hasCssRules)
.reduce(
(finalArr, sheet) =>
finalArr.concat(