W3C home > Mailing lists > Public > www-html@w3.org > February 2002

Re: Empty script tags cause trouble.

From: Christian Wolfgang Hujer <Christian.Hujer@itcqis.com>
Date: Sat, 16 Feb 2002 01:30:23 +0100
To: "Edwin van Vliet" <cheatah@50hertz.net>, <www-html@w3.org>
Message-ID: <16bsnR-0FXXN2C@fmrl09.sul.t-online.com>
Hello Edwin,


Am Samstag, 16. Februar 2002 00:01 schrieb Edwin van Vliet:
> If a shorthand empty script tag is included anywhere in the document, most
> HTML editors get into trouble, especially the syntax highlighting is all
> wrong. So the next sample doesn't work well:
>
> <script type="text/javascript" src="somescript.js" />
>
> While the normal method works as expected:
>
> <script type="text/javascript" src="somescript.js"></script>
>
> As worst of all: Internet Explorer fails on this piece of code as well, yet
> Mozilla and Netscape act as I think they should. Therefore I would very
> much like to know why this isn't handled properly. Is this not valid XHTML,
> or is this a bug in the different types of software? The w3 validator does
> not return any errors, so I can only think of 2 possible causes:
>
> 1: a bug in a lot of editors and even browsers
> 2: a bug in the w3 validator
>
> Or might there be other things I didn't think of?

1 is right.
Most HTML software still is not aware of XHTML. XHTML is already quite 
mature, it is a more than one year old recommendation, but still most 
software fails to interpret XHTML documents correctly.
Most socalled HTML software is even not capable of reading / writing proper 
HTML using a well defined version of HTML, but instead does some sort of 
tag soup which looks like HTML but isn't HTML.

Sounds cruel, but that's the truth.

XML/XHTML is trying to solve this problem. But vendors still fail. Some are 
doing little steps, but a few steps is just nothing on a marathon.

And, even worse, browsers are required to display web content. Oh, of course 
that's not bad in the first place, but - trying to find technically valid web 
content is like the search for the needle in the hay stack.

So if someone would release a browser that only supports the most important 
HTML versions (HTML 2.0, HTML 3.2, HTML 4, HTML 4.01, XHTML 1.0, XHTML 1.1, 
XHTML Basic and other XHTML Modularization dialects using XML and CSS), such 
software would probably display less than 1% of current web content :(

Another cruel truth: Only 1% of socalled web designers deserve their title. I 
regularly meet people that are doing HTML for years and think they are good 
at it but never have heard of the W3C.
(Okay, I'm in a bad mood today, but I really could not restrain to say that, 
I'm just coming from a discussion with such a narrow-minded guy that said he 
is very good at HTML but he has no idea what SGML, XML or XHTML might be, he 
even has never heard of SGML or XHTML before... another guy I would never 
give a job, or as some little guy on one of my t-shirts says: <q>Every day of 
my life I am forced to add another name to the list of people who piss me 
off.</q>)


Sorry, back to the topic.

The EmptyElemTag for Script, <script type="text/ecmascript" src="..." /> 
(Though not already a normal RFC, I prefer ecmascript over javascript, but 
this is a personal preference), is correct. It's browsers and editors that 
fail.

For compatibility with those bugs in browsers, it's required to use the 
StartTag EndTag version.


Handy information:

Often, EmptyElemTags for <script/> are the result of transformation using 
XSLT or DOM.
This little transformation stylesheet fragment might be helpful:
<xsl:transform match="script">
	<xsl:copy>
		<xsl:apply-templates select="@*|node()" />
		<xsl:if test="not(.//text())"><xsl:text> </xsl:text></xsl:if>
	</xsl:copy>
</xsl:transform>
This will force a conformant transformation processor use the StartTag EndTag 
version.



Greetings

P.S.:
I know this mail is bad and too long. This is usually not my style (at least 
I hope so ;-). I cried out my day and I admit I now am too lazy to shorten 
the mail.
-- 
Christian Wolfgang Hujer
Geschäftsführender Gesellschafter
ITCQIS GmbH
Telefon: +49 (089) 27 37 04 37
Telefax: +49 (089) 27 37 04 39
E-Mail: mailto:Christian.Hujer@itcqis.com
WWW: http://www.itcqis.com/
Received on Friday, 15 February 2002 19:35:27 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 March 2012 18:15:50 GMT