File tree Expand file tree Collapse file tree 1 file changed +18
-7
lines changed
Expand file tree Collapse file tree 1 file changed +18
-7
lines changed Original file line number Diff line number Diff line change 179179 }
180180 }
181181
182- var regex = / , ? ( [ ^ , \n ] + ?) \[ [ \s \t ] * ?( m i n | m a x ) - ( w i d t h | h e i g h t ) [ \s \t ] * ?[ ~ $ \^ ] ? = [ \s \t ] * ?" ( [ ^ " ] * ?) " [ \s \t ] * ?] ( [ ^ \n \s \{ ] * ?) / mgi;
182+ var queryRegex = / \[ ( m i n | m a x ) \- ( w i d t h | h e i g h t ) [ \b \~ \| \^ \$ \* ] = \" ( \w * ) \" / mgi;
183+ /**
184+ * @param {String } css
185+ */
186+ function extractQuery ( selector , css ) {
187+ var match ;
188+ while ( null !== ( match = queryRegex . exec ( css ) ) ) {
189+ if ( 3 < match . length ) {
190+ queueQuery ( selector , match [ 1 ] , match [ 2 ] , match [ 3 ] ) ;
191+ }
192+ }
193+ }
194+
195+ var selectorRegex = / (?: ^ | ) ( [ \. \# \[ \] \- \w ] * ) \[ (?: m i n | m a x ) \- (?: w i d t h | h e i g h t ) [ \~ \| \^ \$ \* ] ? = \" \w * \" \] (?: [ \s , ] | [ ^ \] ] + \] ? ( [ \. \# \- \w \~ \| \^ \$ \* \= \" ] + ) ) / mgi;
183196
184197 /**
185198 * @param {String } css
186199 */
187- function extractQuery ( css ) {
200+ function extractSelector ( css ) {
188201 var match ;
189- var smatch ;
190202 css = css . replace ( / ' / g, '"' ) ;
191- while ( null !== ( match = regex . exec ( css ) ) ) {
192- if ( 5 < match . length ) {
193- smatch = match [ 1 ] || match [ 5 ] || smatch ;
194- queueQuery ( smatch , match [ 2 ] , match [ 3 ] , match [ 4 ] ) ;
203+ while ( null !== ( match = selectorRegex . exec ( css ) ) ) {
204+ if ( 1 < match . length ) {
205+ extractQuery ( match [ 1 ] || match [ 2 ] , match [ 0 ] ) ;
195206 }
196207 }
197208 }
You can’t perform that action at this time.
0 commit comments