Click here to Skip to main content
15,889,909 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
When you type Script Lang...,

Visual studio objects to 'Language' and prefers something like 'Lang' telling that HTML5 has no such attribute like 'language' for script tag.

Is this a Microsoft-driven HTML5 extension or W3C recommendation? I could not find an equivalent citation in the latter site and hence asking this question.
Posted
Comments
Prasad Khandekar 4-Jun-13 10:50am    
The language attribute is applicable for server side script blocks only. lang on the other hand is a HTML element's attribute that specifies the language of the element's content.
Manfred Rudolf Bihy 4-Jun-13 11:11am    
Sounds like a sensible solution to me. Why did you make it a comment? :)
Sergey Alexandrovich Kryukov 4-Jun-13 12:22pm    
First of all, none of these attributes is needed in script. Please see my answer.
And "language" did exist in HTML, otherwise why is it mentioned in HTML5 specs, as obsolete (for script element)? Please see the reference I provided.
—SA

1 solution

In HTML5, the "language" attribute for script is claimed obsolete:
http://www.w3.org/TR/html-markup/script.html[^].

However, nor attribute, neither "lang" weren't really needed earlier. Please see what HTML 4.01 specification says:
http://www.w3.org/TR/html401/interact/scripts.html#h-18.2.2[^].

Script element language is controlled by the attribute "content".

However, perhaps there is a confusion. What do you mean by "language"? Computer language or the language associated with the human cultures (English, French, etc.)? If you mean the second thing, I don't see why such attribute should belong to the scrip. Script is code, should be neutral. If you used some culture-specific text in the code of script, it would be a bad practice; you could always get some text you need from data, such as HTML DOM itself.

—SA
 
Share this answer
 
Comments
Vasudevan Deepak Kumar 4-Jun-13 13:49pm    
Thank you, Sergey.

I tried <script language="C#" runat="server">. That passed Visual Studio warnings as other poster commented.
Sergey Alexandrovich Kryukov 4-Jun-13 15:29pm    
Great, thank you for the confirmation. It's a pleasure to help someone who is so responsive and can actually use it.

Good luck, call again.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900