[frontend] Prevent js error on empty stylesheets in embedded mode
// modals, a parent container might have it set to !important which will prevent the modal from showing. This
// redefines all .hide definitions to exclude .modal.fade
for (var i = 0; i < document.styleSheets.length; i++) {
+ if (document.styleSheets[i] && document.styleSheets[i].cssRules) {
for (var j = document.styleSheets[i].cssRules.length - 1; j > 0; j--) {
- if (document.styleSheets[i].cssRules[j].selectorText === '.hide') {
+ if (document.styleSheets[i] && document.styleSheets[i].cssRules[j] && document.styleSheets[i].cssRules[j].selectorText === '.hide') {
var originalCssText = document.styleSheets[i].cssRules[j].cssText;
if (originalCssText.indexOf('!important') !== -1) {
document.styleSheets[i].deleteRule(j);
}
}
}
+ }
// Add modified URL for .clearable background
var originalClearableImgUrl = '${ static('desktop/art/clearField@2x.png') }';
