-
Notifications
You must be signed in to change notification settings - Fork 222
Razor does not correctly parse HTML attributes that have spaces surrounding the equals #123
Comments
In generated code, this bug means Quick samples:
WriteAttribute("class", Tuple.Create(" class=", 82), Tuple.Create("", 96),
Tuple.Create(Tuple.Create("", 89), Tuple.Create<System.Object, System.Int32>(
#line 6 ""
classy
#line default
#line hidden
WriteLiteral("<html>\r\n <head>\r\n <title>This is a title</title>\r\n </head>\r\n <body>\r\n <di" +
"v class =");
Write(
#line 6 ""
classy
#line default
#line hidden
); |
Consider porting back to fix https://aspnetwebstack.codeplex.com/workitem/2149 when this gets fixed |
According to the W3.org spec, you are not supposed to be allowed to have a space between the attribute name and = though. Should it still allow that? If it is just a matter of getting the HtmlMarkupParser to accept spaces before and after the = character, I might be able to help out with that if you want me to? |
@ChrisKlug the HTML5 spec allows it. See: http://www.w3.org/TR/html-markup/syntax.html#syntax-attr-double-quoted
|
You are absolutely correct. I read the http://www.w3.org/html/wg/drafts/html/master/syntax.html#attribute-name-state state-handling wrong. I guess I should stop questioning things now... :) |
Note place for reaction: 4c5f9c5#diff-58782e50bed88f4f2f70af4835346999R476 |
- #123 - Handled the corresponding cases in tag helper scenarios - Added unit and code generation tests
- #123 - Handled the corresponding cases in tag helper scenarios - Added unit and code generation tests
- #123 - Handled the corresponding cases in tag helper scenarios - Added unit and code generation tests
After playing around with the parse tree a bit I noticed that if you were to create HTML elements such as:
The Razor parser does not generate an accurate syntax tree (which is used to generate correct "dynamic" attribute code) that can pull the full attribute value out of the HTML output if the inner condition results to false.
Once this has been added we should also support this attribute syntax in Tag Helpers.
The text was updated successfully, but these errors were encountered: