Skip to content

Commit 7f0d78c

Browse files
Merge branch 'feature/multi-query-support'
2 parents c16cdc9 + 97b7e6b commit 7f0d78c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/ElementQueries.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,17 +179,19 @@
179179
}
180180
}
181181

182-
var regex = /,?([^,\n]*)\[[\s\t]*(min|max)-(width|height)[\s\t]*[~$\^]?=[\s\t]*"([^"]*)"[\s\t]*]([^\n\s\{]*)/mgi;
182+
var regex = /,?([^,\n]*?)\[[\s\t]*?(min|max)-(width|height)[\s\t]*?[~$\^]?=[\s\t]*?"([^"]*?)"[\s\t]*?]([^\n\s\{]*?)/mgi;
183183

184184
/**
185185
* @param {String} css
186186
*/
187187
function extractQuery(css) {
188188
var match;
189+
var smatch;
189190
css = css.replace(/'/g, '"');
190191
while (null !== (match = regex.exec(css))) {
191192
if (5 < match.length) {
192-
queueQuery(match[1] || match[5], match[2], match[3], match[4]);
193+
smatch = match[1] || match[5] || smatch;
194+
queueQuery(smatch, match[2], match[3], match[4]);
193195
}
194196
}
195197
}

0 commit comments

Comments
 (0)