Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Closed Issue: A Small Razor Breaking Change in Razor Section [940]

$
0
0
If you have section like,


``` C#
@section scriptBlock{
var a = 1;
if(a < 3){
//
}
}
```
Then it will fail in Razor V2 but works in Razor V1. See this,
http://forums.asp.net/t/1893377.aspx/1?section+containing+jquery+code+not+working+after+migrating+to+MVC+4


Comments: This is a breaking change, but a desirable one. A section block should contain markup and razor code. Javascript at the top level is treated as markup, and in this case it's invalid markup. As the comments say, use <text></text> if you need to partially render a script.

Viewing all articles
Browse latest Browse all 7215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>