File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2626 submitted to the server. This caused invalid data in rare occasions.
2727 * Fix: In the ` Selectize ` widget, the placeholder in the internal lookup field now is only
2828 rendered if nothing has been selected.
29+ * Fix: CSS loading problems, if 3rd party CSS is loaded from external sources.
2930
3031- 2.2.4
3132 * Fix #266 : Timing issue in widgets ` DateField ` and ` DateTimeField ` . Input focus switched before
Original file line number Diff line number Diff line change @@ -136,9 +136,20 @@ export namespace StyleHelpers {
136136 export function stylesAreInstalled ( baseSelector : string ) : CSSStyleSheet | null {
137137 // check if styles have been loaded for this widget and return the CSSStyleSheet
138138 for ( let k = document . styleSheets . length - 1 ; k >= 0 ; -- k ) {
139- const cssRule = document ?. styleSheets ?. item ( k ) ?. cssRules ?. item ( 0 ) ;
140- if ( cssRule instanceof CSSStyleRule && cssRule . selectorText . trim ( ) === baseSelector ) {
141- return document . styleSheets . item ( k ) ;
139+ try {
140+ const cssRule = document ?. styleSheets ?. item ( k ) ?. cssRules ?. item ( 0 ) ;
141+ if ( cssRule instanceof CSSStyleRule && cssRule . selectorText . trim ( ) === baseSelector ) {
142+ return document . styleSheets . item ( k ) ;
143+ }
144+ } catch ( e : any ) {
145+ if ( e . name === 'SecurityError' ) {
146+ // Trying (and failing) to load a stylesheet from another domain.
147+ // It won't be the one we're looking for, so just swallow the error.
148+ // Please also read
149+ // https://medium.com/better-programming/how-to-fix-the-failed-to-read-the-cssrules-property-from-cssstylesheet-error-431d84e4a139
150+ } else {
151+ throw e ;
152+ }
142153 }
143154 }
144155 return null ;
You can’t perform that action at this time.
0 commit comments