diff --git a/src/Microsoft.AspNet.Razor/Parser/TagHelpers/TagHelperParseTreeRewriter.cs b/src/Microsoft.AspNet.Razor/Parser/TagHelpers/TagHelperParseTreeRewriter.cs index 163e80ab44..f9704e3441 100644 --- a/src/Microsoft.AspNet.Razor/Parser/TagHelpers/TagHelperParseTreeRewriter.cs +++ b/src/Microsoft.AspNet.Razor/Parser/TagHelpers/TagHelperParseTreeRewriter.cs @@ -324,12 +324,25 @@ namespace Microsoft.AspNet.Razor.Parser.TagHelpers.Internal childSpan = child as Span; } - var attributeName = childSpan - .Content - .Split(separator: new[] { '=' }, count: 2)[0] - .TrimStart(); + var start = 0; + for (; start < childSpan.Content.Length; start++) + { + if (!char.IsWhiteSpace(childSpan.Content[start])) + { + break; + } + } - attributeNames.Add(attributeName); + var end = 0; + for (end = start; end < childSpan.Content.Length; end++) + { + if (childSpan.Content[end] == '=') + { + break; + } + } + + attributeNames.Add(childSpan.Content.Substring(start, end - start)); } return attributeNames;