zmoazeni / csscss

A CSS redundancy analyzer that analyzes redundancy.
http://zmoazeni.github.io/csscss/
MIT License
2.92k stars 151 forks source link

Comments/charset declarations are included in selectors #97

Open tomdenbraber opened 8 years ago

tomdenbraber commented 8 years ago

Hi,

I encountered the problem that the CSS parser includes comments in selector names. Example CSS:

/* A comment before a selector*/
h1 {
   /* 
     some redundant selectors here
     ...
   */ 
}

Let's assume h1 contains redundancy and ends up in the JSON structure. This JSON structure now contains a selector in the list called "/* A comment before a selector*/h1", while the correct selector is just "h1".

The same problem occurs when having a @charset declaration just before a selector.

Thanks in advance!