-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Open
Labels
area-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesIncludes: MVC, Actions and Controllers, Localization, CORS, most templates
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
The Net9 issue has already been reported and fixed here: #58973
Using Net10, razor project, and adding a <script type="importmap"> tag and attribute causes the type attribute to be stripped from the script element.
It only works if Html.Raw is used to bypass the validations, or if the notation "<!script...>" is used. Notice the exclamation mark.
Expected Behavior
The script tag should retain the type attribute when "importmap" is input.
Steps To Reproduce
Steps
1 - New Net10 razor project.
2 - Insert one of these scripts (or both - alternatively) on the index page.
Primary fail example
<script type="importmap">
{
"imports": {
}
}
</script>
Secondary fail example
<text>
<script type="importmap">
{
"imports": {
}
}
</script>
</text>
3 - Start the project.
4 - Open the dev tools.
5 - Refresh.
6 - See it break with Uncaught SyntaxError: unexpected token: ':'
It works as:
<!script type="importmap">
{
"imports": {
}
}
</script>
or using the Html.Raw function
Exceptions (if any)
No response
.NET Version
10.0.101
Anything else?
No response
Metadata
Metadata
Assignees
Labels
area-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesIncludes: MVC, Actions and Controllers, Localization, CORS, most templates