The ":only-child" selector does not capture the HTML element
Closed this issue · 0 comments
atifaziz commented
Code to reproduce (using version 1.2):
using var client = new HttpClient();
var doc = new HtmlDocument();
doc.LoadHtml(await client.GetStringAsync("https://www.example.com/"));
foreach (var e in doc.DocumentNode.QuerySelectorAll(":only-child"))
Console.WriteLine(e.Name);
It finds only 2 elements:
div
a
whereas using document.querySelectorAll(':only-child')
in Chrome finds html
in addition to the above two.