开发者

HTML: Why script tags should always have full ending? [duplicate]

This question already has answers here: Closed 12 years ago.

Possible Duplicate:

Why don’t self-closing script tags work?

I wonder why scripts included into header html tag should always have full ending <tag></tag> like this:

<script src="/scripts/jquery-1.4.1.min.js" type="text/javascript"></script>

while xml well-formed shortened form <tag/> makes browsers crazy:

<script src="/scripts/jquery-1.4.1.min.js" type="text开发者_如何学运维/javascript" />

Browsers tend to demonstrate blank screen instead of page, though html layout is present.

EDIT:

Thank you guys, my question is duplicate to this one asked earlier


Why don't self-closing script tags work?


W3.org - 18.2.1 The SCRIPT element

<!ELEMENT SCRIPT - - %Script;          -- script statements -->
<!ATTLIST SCRIPT
  charset     %Charset;      #IMPLIED  -- char encoding of linked resource --
  type        %ContentType;  #REQUIRED -- content type of script language --
  src         %URI;          #IMPLIED  -- URI for an external script --
  defer       (defer)        #IMPLIED  -- UA may defer execution of script --
  >

Start tag: required, End tag: required

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜