Is it good practice to ignore script type?

Possible duplicate:
HTML5 <script> ads

I heard that some people say that you do not need to indicate type="text/javascript"in the tag <script>, as this is the default type.

Is there a drawback if I open script tags as <script>instead of more verbose <script type="text/javascript">?

+5
source share
4 answers

HTML4 requires an attribute type:

http://www.w3.org/TR/html401/interact/scripts.html#h-18.2.1

In HTML5, this is not the case.

http://dev.w3.org/html5/markup/script.html

HTML4, , , . HTML5, , <script> type text/javascript, .

+3

! . , - HTML5 .

<!doctype html>

, , .

" " , HTML5, :)

+1

, script HTML5, , , . script HTML-. , . script, type .

+1

You are developing a website for an intranet (possibly an Internet camera), you can write:

<script>
   $(functions(){});
</script>

If you are using HTML or XHTML for the web, I suggest you write script tags as follows:

<script type="text/javascript">
// <![CDATA[
   // functions
   $(functions(){}); 
// ]]>

And to complete this for Inline CSS, since we are on it:

<style type="text/css">
/* <![CDATA[ */
    /* tags */
    html, body {}
/* ]]> */
</style>

Thus, any character you enter there must have a valid character

EDIT http://en.wikipedia.org/wiki/CDATA#Uses_of_CDATA_sections

0
source

All Articles