Menu

#40 Media queries are not parsed, when they contain operators

0.9.15
closed
RBRi
@media (1)
1
2015-03-25
2013-06-19
SoftVision
No

Parsing media query "@media" does not support operators like "and", "not", "only" and so on. The parser ignores the whole rule, when it contains such an operator.

Example:
@media screen and (min--moz-device-pixel-ratio:0) { .channel-list a { padding: 2px 10px 5px; line-height: 17px; } }

Discussion

  • RBRi

    RBRi - 2013-06-27
    • status: open --> accepted
    • assigned_to: RBRi
     
  • RBRi

    RBRi - 2013-09-13
    • Group: 0.9.8 --> unassigned
     
  • RBRi

    RBRi - 2013-09-13
    • Group: unassigned --> 0.9.11
     
  • RBRi

    RBRi - 2014-01-07
    • Group: 0.9.11 --> 0.9.12
     
  • RBRi

    RBRi - 2014-01-20
    • Group: 0.9.12 --> 0.9.14
     
  • RBRi

    RBRi - 2014-05-08
    • Group: 0.9.14 --> 0.9.15
     
  • Anonymous

    Anonymous - 2014-07-07

    Is there a workaround for this?

     
    • RBRi

      RBRi - 2014-07-07

      No workaround known so far.
      My time is really limited at the moment, don't expect any progress in the next weeks.
      But feel free to provide a patch....

       
  • Manuel Blechschmidt

    I currently need this as well.

     
  • Manuel Blechschmidt

    I wrote a patch that now makes it possible to parse such media queries.

    Unfortunately I never attended a compiler building lecture nevertheless I did the following:

    1. extended the grammar using the EBNF defined here: http://www.w3.org/TR/2012/REC-css3-mediaqueries-20120619/
      (had some problems with code too large exceptions so I used direct string literals instead of tokens https://java.net/jira/browse/JAVACC-261)
    2. Added a new class SACMediaCondition (should be added so SAC 1.4 as well)
    3. Added a property media2condition in MediaListImpl and SACMediaListImpl
    4. Added the generation of media conditions in getMediaText() in MediaListImpl
    5. Wrote a limited test case that checks the parsing functionality SACParserCSS3Test.java mediaConditions

    The code is not yet production ready but solves all given problems in a stable way. It will need more testing and maturing further the w3c should integrate the new media queries in the SAC API.

     
  • RBRi

    RBRi - 2014-12-08

    Hi Manuel,
    many thanks for your patch. Will work on this during the next days.

     
  • Manuel Blechschmidt

    Thanks!

     
  • Anonymous

    Anonymous - 2015-02-23

    Is this bug now fixed in a stable version?

     
  • Manuel Blechschmidt

    I would guess no

     
  • RBRi

    RBRi - 2015-02-28

    Hi all brave css-parsers,

    sorry for the long delay with this issues. My spare time during the last weeks was really limited (as always) and there was a lot of things to do in the HtmlUnit/Wetator area.
    Based on Manuels patch i finally have created a fist version of the media query support. If you like, you can download the latest snapshot and test it.

    If possible i will spend some more time on finishing and will release a new version soon.

    Thanks for your patience

    RBRi
    
     
  • RBRi

    RBRi - 2015-03-06

    An updated snapshot is available (again some unicode fixes).
    Any feedback?

    RBRi
    
     

    Last edit: RBRi 2015-03-06
  • Manuel Blechschmidt

    @RBRi: Sorry, but I won't have the time to test the snapshot.

     
  • RBRi

    RBRi - 2015-03-25

    release is available

     
  • RBRi

    RBRi - 2015-03-25
    • status: accepted --> closed
     

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.