Skip to content

Removing properties causes empty value when serializing #14

Closed
@mganss

Description

@mganss

Example:

var p = new HtmlParser(new HtmlParserOptions(), BrowsingContext.New(new Configuration().WithCss()));
var dom = p.ParseDocument(@"<html><body><div style=""background: 0;"">Test</div></body></html>");
var div = dom.QuerySelector("div");
var style = div.GetStyle();
style.RemoveProperty("background-position-x");
style.RemoveProperty("background-position-y");
var css = style.CssText; // -> "background: "

FWIW, both Chrome and Firefox output "background-color: rgba(0, 0, 0, 0); background-repeat: repeat; background-attachment: scroll; background-image: none; background-size: auto auto; background-origin: padding-box; background-clip: border-box;" in this case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions