This is a migrated thread and some comments may be shown as answers.

[Solved] Bug ? related to script tag in MVC 3 Razor template

2 Answers 130 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Carl
Top achievements
Rank 1
Carl asked on 31 Jan 2011, 04:00 AM
In the MVC 3 Razor template for the Telerik Extensions for MVC (latest release), there's a script tag in the Shared View called _Layout.cshtml that has a full close tag like this:

<script src="@Url.Content("~/Scripts/jquery-1.4.4.min.js")" type="text/javascript"></script> 

and the template does work and the Home and About pages appear correctly. However, if you just edit the full close tag to the abbreviated close tag like this:

<script src="@Url.Content("~/Scripts/jquery-1.4.4.min.js")" type="text/javascript" /> 

the Home and About pages NO longer appear.

Consistent with my style conventions, I would like to believe that I could replace any full close tag with the abbreviated close tag form on an element that has empty content. But apparently not!

I believe it's a bug. Or if it's intentional behavior, then could somebody explain why it's necessary?

2 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 31 Jan 2011, 08:24 AM
Hello Carl,

Indeed this is expected behavior. As you may know script tags cannot be self closing but only full closing.

All the best,
Rosen
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Carl
Top achievements
Rank 1
answered on 31 Jan 2011, 04:48 PM
Hhhhmmm... how annoying and inconsistent.... and it may be "expected" in one sense but not in another. So far I have not yet found the formal specification that says it is not possible. I have found some discussion that attributes problems to the doctype declaration, etc. Here's a link for some discussion:

http://stackoverflow.com/questions/97522/what-are-all-the-valid-self-closing-tags-in-xhtml-as-implemented-by-the-major-br

Seems like the safest approach is to AVOID any self-closing tags whether for script, div, or any other at risk tags... so as not to worry about whether the doctype declaration.
Tags
General Discussions
Asked by
Carl
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Carl
Top achievements
Rank 1
Share this question
or