CsCss
CsCss copied to clipboard
Pseudo elements parsing and case sensitivity
According to the CSS docs (http://www.w3.org/TR/CSS2/selector.html § 5.10), pseudo elements and pseudo classes are case-insensitive. Values like :first-child, :First-Child or :FIRST-CHILD should be parsed in the same way.
The following snippet validates correctly with the w3 CSS validator but fails to be parsed with CsCss 1.0.1.0:
@charset "UTF-8";
div:First-Child {
text-align: center;
}
I've tested it using the project sources by adding the following test case :
[TestMethod]
public void CssFirstChild_20140527()
{
var loader = new CssLoader();
var css = loader.ParseSheet(Css20140527_pseudo_element_case, SheetUri, BaseUri);
Assert.IsTrue(css.StyleRules.Any(), "No rules found");
}
private string Css20140527_pseudo_element_case
{
get { return GetResourceFile("20140527_pseudo-element-case.css"); }
}
As a temporary / permanent workaround I'll update my CSS files to use lower case pseudo elements.