Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

background "<bg-position> / <bg-size>" syntax unsupported #165

Open
5 tasks done
mganss opened this issue Mar 18, 2024 · 1 comment
Open
5 tasks done

background "<bg-position> / <bg-size>" syntax unsupported #165

mganss opened this issue Mar 18, 2024 · 1 comment
Labels
Milestone

Comments

@mganss
Copy link
Contributor

mganss commented Mar 18, 2024

Prerequisites

  • Can you reproduce the problem in a MWE?
  • Are you running the latest version of AngleSharp.Css?
  • Did you check the FAQs to see if that helps you?
  • Are you reporting to the correct repository? (there are multiple AngleSharp libraries, e.g., AngleSharp.Xml for Xml support)
  • Did you perform a search in the issues?

Description

The syntax for background specifying both position and size separated by a slash is unsupported. #124 seems to be related.

This was initiallly reported as mganss/HtmlSanitizer#536

Steps to Reproduce

var html = @"<div style=""background: center / cover;""></div>";
var conf = Configuration.Default.WithCss(new CssParserOptions
{
    IsIncludingUnknownDeclarations = true,
    IsIncludingUnknownRules = true,
    IsToleratingInvalidSelectors = true,
});
var parser = new HtmlParser(new HtmlParserOptions { IsScripting = true }, BrowsingContext.New(conf));
var dom = parser.ParseDocument(html);
var elem = dom.QuerySelector("div");
var style = elem.GetStyle();
var styleCount = style.Count(); // -> 0

Expected Behavior

The number of styles is nonzero.

Actual Behavior

The number of styles is zero.

Possible Solution / Known Workarounds

No response

@mganss mganss added the bug label Mar 18, 2024
@FlorianRappl FlorianRappl added this to the v1.0 milestone Apr 2, 2024
@ikesnowy
Copy link

ikesnowy commented Oct 16, 2024

Getting same problem here, I believe it's because the / is not been skipped by calling SkipSpacesAndComments:

Debugger page:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants