Skip to content

Commit 31ea756

Browse files
committed
Updated changed from pull request marcj#69
1 parent a6a4ee2 commit 31ea756

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/ElementQueries.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@
198198
}
199199

200200
var regex = /,?([^,\n]*?)\[[\s\t]*?(min|max)-(width|height)[\s\t]*?[~$\^]?=[\s\t]*?"([^"]*?)"[\s\t]*?]([^\n\s\{]*?)/mgi;
201+
var ieReg = /,?([^,\n]*?)\[*?(min|max)-(width|height)[\s\t]*?[~$\^]?=[\s\t]*?"([^"]*?)"[\s\t]*?]([^\n\s\{]*?)([.|\#]\w*[^,\n\t\s])/mgi;
201202

202203
/**
203204
* @param {String} css
@@ -212,6 +213,12 @@
212213
queueQuery(smatch, match[2], match[3], match[4]);
213214
}
214215
}
216+
while (null !== (match = ieReg.exec(css))) {
217+
if (5 < match.length) {
218+
219+
queueQuery(match[6], match[2], match[3], match[4]);
220+
}
221+
}
215222
}
216223

217224
/**
@@ -256,7 +263,11 @@
256263
readRules(document.styleSheets[i].cssText || document.styleSheets[i].cssRules || document.styleSheets[i].rules);
257264
} catch(e) {
258265
if (e.name !== 'SecurityError') {
259-
throw e;
266+
if (e.name === 'SyntaxError') {
267+
throw 'comma seperated css rules not allowed in IE ' + e.name;
268+
} else {
269+
throw e;
270+
}
260271
}
261272
}
262273
}

0 commit comments

Comments
 (0)