jamietre / CsQuery

CsQuery is a complete CSS selector engine, HTML parser, and jQuery port for C# and .NET 4.
Other
1.15k stars 249 forks source link

Selector doesn't work correctly with same elements next to each other #196

Open tariqporter opened 9 years ago

tariqporter commented 9 years ago
CsQuery.CQ test = "<p><em>Hello</em><em>World</em></p>";
test.Select("em").Before("{EM_BEFORE}");
test.Select("em").After("{EM_AFTER}");
test.Remove("em");
var test2 = test.Text().Replace("{EM_BEFORE}", "<em>").Replace("{EM_AFTER}", "</em>");

Gets rid of one of the closing </em> s, outputting: <em>Hello<em>World</em> jQuery handles this correctly.