@@ -60,7 +60,8 @@ pub fn css_to_style<'a>(
6060 let sel = input[ ..start] . trim ( ) . to_string ( ) ;
6161 if sel. starts_with ( "@media" ) {
6262 Some ( StyleSelector :: Media {
63- query : sel. replace ( " " , "" ) [ "@media" . len ( ) ..] . to_string ( ) ,
63+ query : sel. replace ( " " , "" ) . replace ( "and(" , "and (" ) [ "@media" . len ( ) ..]
64+ . to_string ( ) ,
6465 selector : None ,
6566 } )
6667 } else {
@@ -268,11 +269,11 @@ mod tests {
268269 }" ,
269270 vec![
270271 ( "border" , "1px solid #000" , Some ( StyleSelector :: Media {
271- query: "(min-width:768px)and(max-width:1024px)" . to_string( ) ,
272+ query: "(min-width:768px)and (max-width:1024px)" . to_string( ) ,
272273 selector: None ,
273274 } ) ) ,
274275 ( "color" , "#FFF" , Some ( StyleSelector :: Media {
275- query: "(min-width:768px)and(max-width:1024px)" . to_string( ) ,
276+ query: "(min-width:768px)and (max-width:1024px)" . to_string( ) ,
276277 selector: None ,
277278 } ) ) ,
278279 ( "border" , "1px solid #000" , Some ( StyleSelector :: Media {
@@ -338,19 +339,19 @@ mod tests {
338339 }" ,
339340 vec![
340341 ( "border" , "1px solid #FFF" , Some ( StyleSelector :: Media {
341- query: "(max-width:768px)and(min-width:480px)" . to_string( ) ,
342+ query: "(max-width:768px)and (min-width:480px)" . to_string( ) ,
342343 selector: None ,
343344 } ) ) ,
344345 ( "color" , "#FFF" , Some ( StyleSelector :: Media {
345- query: "(max-width:768px)and(min-width:480px)" . to_string( ) ,
346+ query: "(max-width:768px)and (min-width:480px)" . to_string( ) ,
346347 selector: None ,
347348 } ) ) ,
348349 ( "border" , "1px solid #000" , Some ( StyleSelector :: Media {
349- query: "(max-width:768px)and(min-width:480px)" . to_string( ) ,
350+ query: "(max-width:768px)and (min-width:480px)" . to_string( ) ,
350351 selector: Some ( "&:hover" . to_string( ) ) ,
351352 } ) ) ,
352353 ( "color" , "#000" , Some ( StyleSelector :: Media {
353- query: "(max-width:768px)and(min-width:480px)" . to_string( ) ,
354+ query: "(max-width:768px)and (min-width:480px)" . to_string( ) ,
354355 selector: Some ( "&:hover" . to_string( ) ) ,
355356 } ) ) ,
356357 ( "border" , "1px solid #FFF" , Some ( StyleSelector :: Media {
@@ -392,11 +393,11 @@ mod tests {
392393 selector: None ,
393394 } ) ) ,
394395 ( "border" , "1px solid #000" , Some ( StyleSelector :: Media {
395- query: "(max-width:768px)and(min-width:480px)" . to_string( ) ,
396+ query: "(max-width:768px)and (min-width:480px)" . to_string( ) ,
396397 selector: None ,
397398 } ) ) ,
398399 ( "color" , "#000" , Some ( StyleSelector :: Media {
399- query: "(max-width:768px)and(min-width:480px)" . to_string( ) ,
400+ query: "(max-width:768px)and (min-width:480px)" . to_string( ) ,
400401 selector: None ,
401402 } ) ) ,
402403 ]
0 commit comments