Quantcast
Channel: Optimizely Search & Navigation
Viewing all articles
Browse latest Browse all 6894

XhtmlString does not parse empty HTML span element

$
0
0

Hello,

I parse the following HTML string with XhtmlString class:

var incorrect = new XhtmlString(@"<span class=""myclassname"" aria-hidden=""true""></span>");

After parsing, the object incorrect does not containt any fragments but it should contain a fragment containing the span element. If I test parsing

var correct = new XhtmlString(@"<span class=""myclassname"" aria-hidden=""true""> </span>");

the result is correct and I get the elements. (Note the whitespace character in span element.)

Is there any way to fix this other than adding a whitespace to all empty elements? I think the default behavior of XhtmlString parser should be to parse the element without checking whether there is content inside the element.

Note: I did not test it with other HTML elements but it shouldn't really matter which element we are using.


Viewing all articles
Browse latest Browse all 6894

Trending Articles