I’m looking for some guidance on extracting the rules and property/values from a .css file or <style></style>.
I don’t need a full blown parser because I don’t care if the selector text, property name or property value is valid or not; I just need to make sure that I don’t split the text where I shouldn’t do and I ignore text within comments etc.
As I say, I’m just looking for guidance but if there is an example in C# or VB then even better.
I would ultimately end up with a collection of rules. Each rule would contain the selector text and a collection of property/value pairs.
I can get this information using the .NET Webbrowser control but unfortunately if it finds a property it recognizes but cannot parse the value, it excludes it. This means that the following would be ignored by the webbrowser control (using IE9):
background-image: linear-gradient(45deg, red, green, blue);
However, if it doesn’t recognize the property, it includes it; so if I modified the line to -foo-background-image: .., it would be picked up.
As an aside, will IE10 be available for Win7 when it is released? I’m a little confused by the ms website which seems to imply it will need Win8. I find it hard to believe that one would need Win8 in order to use the -ms-linear-gradient property.
ETA: I’ve added as many assemblies as possible to reflector and had a search through but I cannot find the classes that the .NET framework uses to extract the rules for the css property browser.
Specifications for syntax and parsing rules:
As for IE10, as far as I know, final version of it will be available for Windows Vista/7 too.