cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robin Rigby" <ro...@gondolier.org.uk>
Subject RE: Javascript Source File can not be directly loaded
Date Sat, 15 Sep 2007 17:06:28 GMT
As has already been pointed out, this is incorrect behaviour of Internet
Explorer.  The short form <script ... /> is not valid xhtml.  You have to
use <script ... > </script>.    HTML is much more tolerant.  IE gets
confused between xhtml and HTML.

I had a particular problem with the JavaScript files belonging to Cocoon
forms, which use the short form.  I did not feel confident to rewrite them,
so I had to insert an XSLT transformation into my pipeline. 

<xsl:template match="script">
	<xsl:element xmlns="http://www.w3.org/1999/xhtml"
name="{local-name()}">
		<xsl:apply-templates select="*|@*|text()"/>
		<xsl:if test="not(string(.))">&#160;</xsl:if>
	</xsl:element>
</xsl:template>

HTH
 
Robin 
 

-----Original Message-----
From: swenzky@krypthonas.de [mailto:swenzky@krypthonas.de] 
Sent: 15 September 2007 16:30
To: users@cocoon.apache.org
Subject: Re: Javascript Source File can not be directly loaded

Just in this case Felix...

This proposed solution won´t work for me...

Its weird, when i try to include a second javascript(first script file is on
other place migrated to use at least one), so it happens that this javscript
wont work. For example, i cannot get access to functions or variables within
this source file... Its like as that they script file never be exist.

What a scary Saturday  :D


Felix Knecht wrote:
> swenzky@krypthonas.de schrieb:
>> Hi there, i´ve since a few days much more problems with Javascript 
>> and Cocoon then ever...
...
>> 
>> Example(in this case there is in test.js a function named "test" 
>> and within of them an alert invocation ):
>> 
>> <xsl:template match="body">
>> 
>> <body> <script src="test/test.js" language="Javascript"/> 
>> <script>test();</script> </body>
> 
> I had simular problems. What helped in my case was to have a starting
>  and ending tag for script like
> 
> <body> <script src="test/test.js" language="Javascript"> <!-- Dummy 
> text --> </script> <script>test();</script> </body>

Yes, that's exactly it; Internet Explorer in particular will ignore
everything after a <script> tag if it is not closed with a </script>
tag.  Using the XML-style closing <script/> will not work.
http://www.phpied.com/ie-script-tag-problem/

Please note this has nothing to do with Cocoon in particular but is
simply a browser issue.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message