Home > Web Front-end > JS Tutorial > Why Do Some Browsers Reject Self-Closing `` Tags?

Why Do Some Browsers Reject Self-Closing `` Tags?

Mary-Kate Olsen
Release: 2024-12-27 09:45:10
Original
723 people have browsed it

Why Do Some Browsers Reject Self-Closing `` Tags?

Why Browser Interpretation of Script Elements Differs

XHTML browsers often fail to recognize script elements written as . This discrepancy raises questions about browser support for XHTML.

HTML Compatibility Guidelines

The XHTML 1 specification provides the non-normative appendix 'HTML Compatibility Guidelines,' which includes the following rule:

C.3. Element Minimization and Empty Element Content

Empty instances of elements with a non-EMPTY content model (such as title and paragraph) should not be minimized using the / syntax.

XHTML Specification

The XHTML DTD specifies script elements as:

<!ELEMENT script (#PCDATA)>
Copy after login

This specification indicates that script elements contain PCDATA (parsed character data), which cannot be empty. Therefore, according to the HTML Compatibility Guidelines, minimizing

Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template