I am writing my own CSS parser and want to use it to style graphic elements in my application (and not in HTML). I want to make sure that this is consistent with the usual CSS behavior when it comes to selector priorities, cascade, etc.
Is there a comprehensive CSS test suite that I can use for this project?
My CSS has most regular syntax functions (for example, matches tag names, identifiers, classes, pseudo-classes) and will share many formatting options using CSS CSS, but also have different styles depending on the type of โdocumentsโ I style.
I was looking for a CSS test suite to test my implementation, but the only ones I could find, such as the W3C test suite , primarily concerned the visual presentation of the document. I am looking for something machine-readable or easily adaptable, and use the CSS mechanism, not the layout mechanism. Something like (pseudo-test spec):
Stylesheet blah.blub { color: red; } .blub { color: blue; } + Document <blah class="blub" /> => Expected result: <blah class="blub" style="color: red" />
or
assert selector "#blub" matches element "moo#blub" assert selector "blah#blub" does not match element "moo#blub" ...
I would also like to check the behavior of CSS shortcuts (e.g. line vs line-color ) in cases where I implemented them identically to HTML. for example
line: 1px solid blue; line-color: red;
leads to the string "1px solid red". Any ideas?
jdm
source share