-
-
Notifications
You must be signed in to change notification settings - Fork 581
Closed
Labels
Description
When I want to serialize an element, the underlying HtmlMarkupFormatter transforms any "&" characters contained in attributes into "&"
Example:
var btn = document.CreateElement("a");
btn.InnerHtml = "Test";
btn.SetAttribute("href", "http://google.com?param=param&q=test");
var html = btn.OuterHtml; // <-- http://google.com?param=param&q=test
Digging into the code, I've found this in HtmlMarkupFormatter.cs, line 118
String IMarkupFormatter.Attribute(IAttr attribute)
...
for (var i = 0; i < value.Length; i++)
{
switch (value[i])
{
case Symbols.Ampersand: temp.Append("&"); break;
case Symbols.NoBreakSpace: temp.Append(" "); break;
case Symbols.DoubleQuote: temp.Append("""); break;
default: temp.Append(value[i]); break;
}
}
I think that, apart from the double quote, the rest of symbols are all valid into an attribute value.