atifaziz/Hazz

QuerySelector does not find class names with line breaks

Closed this issue · 2 comments

I have to parse and query HTML that's formatted badly with line breaks in class attributes. This library does not appear to support those however:

string html = @"<html><body><div class=""class_1""><span class=""class_2
 class_3"">Text</span></body></html>";
HtmlDocument htmldom = new HtmlDocument();
htmldom.LoadHtml(html);

Console.WriteLine(JsonConvert.SerializeObject(htmldom.DocumentNode.QuerySelector(".class_1").FirstChild.GetClasses())); // Prints classes correctly
Console.WriteLine(htmldom.DocumentNode.QuerySelector(".class_1 > .class_2")); // Prints null

It works fine when the line break is removed.

Actually this has been resolved in master way back in April 2020. When will 1.3.0 be out?

Duplicate of #15.