AngleSharp / AngleSharp.Css

:angel: Library to enable support for cascading stylesheets in AngleSharp.
https://anglesharp.github.io
MIT License
72 stars 34 forks source link

Getting `CssText` property throws when style includes all longhands of `grid-template` #68

Closed mganss closed 3 years ago

mganss commented 3 years ago

Repro:

var p = new HtmlParser(new HtmlParserOptions(), BrowsingContext.New(new Configuration().WithCss(new CssParserOptions())));
var dom = p.ParseDocument(@"<html><body><span style=""grid-template-areas: none; grid-template-columns: none; grid-template-rows: none""></body></html>");
var div = dom.QuerySelector("span");
var style = div.GetStyle();
var css = style.CssText;

This throws here: https://github.com/AngleSharp/AngleSharp.Css/blob/5d034bfbbd5a8a6a851e135346fbcc5952173f2e/src/AngleSharp.Css/Values/Composites/CssGridTemplateValue.cs#L66

with the message

Unable to cast object of type 'AngleSharp.Css.Values.Constant`1[System.Object]' to type 'AngleSharp.Css.Values.CssTupleValue'.