HiveBrain v1.2.0
Get Started
← Back to all entries
patternjavascriptCritical

Why don't self-closing script elements work?

Submitted by: @import:stackoverflow-api··
0
Viewed 0 times
closingwhyselfscriptdonworkelements

Problem

What is the reason browsers do not correctly recognize:

 


Only this is recognized:



Does this break the concept of XHTML support?

Note: This statement is correct at least for all IE (6-8 beta 2).

Solution

The non-normative appendix ‘HTML Compatibility Guidelines’ of the XHTML 1 specification says:

С.3. Element Minimization and Empty Element Content

Given an empty instance of an element whose content model is not EMPTY (for example, an empty title or paragraph) do not use the minimized form (e.g. use
and not ``).

XHTML DTD specifies script elements as:

Code Snippets

<!-- script statements, which may include CDATA sections -->
<!ELEMENT script (#PCDATA)>

Context

Stack Overflow Q#69913, score: 521

Revisions (0)

No revisions yet.