Thomas J.S.: Kommentarhierarchie

Beitrag lesen

Hallo Utz!

Allerdings geben die flugs zu Rate gezogenen Specs von HTML 4.01 und sogar schon 2.0 Dir völlig recht.

Vertrauen ist gut, Kontrolle ist besser? ;-))

http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.4

Hhhhmmmm...wo hat Stefan denn dann aber die Info über die // her? Bzw. was meintest Du mit "// (...) nur für Scripte notwendig"?

The JavaScript engine allows the string "<!--" to occur at the start of a SCRIPT element, and ignores further characters until the end of the line. JavaScript interprets "//" as starting a comment extending to the end of the current line. This is needed to hide the string "-->" from the  JavaScript parser.
http://www.w3.org/TR/html4/interact/scripts.html#h-18.3.2

Und das ist auch der Grund warum z.B. bei Netscape CSS ignoriert wird wenn nach <!-- Angaben folgen, da im NS der JS-parser die CSS-Arbeit verrichtet.

Grüße
Thomas