Skip to content

Commit 66f2c25

Browse files
author
Matthew
committed
* Prevent exceptions when IE/firefox load an external css file.
1 parent 44e5276 commit 66f2c25

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/ElementQueries.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,14 @@
262262
try {
263263
readRules(document.styleSheets[i].cssRules || document.styleSheets[i].cssText || document.styleSheets[i].rules);
264264
} catch(e) {
265-
if (e.name !== 'SecurityError') {
266-
if (e.name === 'SyntaxError') {
267-
throw 'comma seperated css rules not allowed in IE ' + e.name;
265+
var name = e.name;
266+
var description = e.description || '';
267+
268+
if (name !== 'SecurityError'
269+
&& name !== 'InvalidAccessError'
270+
&& description.indexOf('Access is denied') === -1) {
271+
if (name === 'SyntaxError') {
272+
throw 'comma seperated css rules not allowed in IE ' + name;
268273
} else {
269274
throw e;
270275
}

0 commit comments

Comments
 (0)