Fog Creek Software
Discussion Board




Knowledge Base
Documentation
Terry's Tips
Darren's Tips

2.0.7 is zapping my js!

Version 2.0.5 was perfect with my js.

Version 2.0.7 is rendering my js unusable. V207 is inserting extra tags. Here are 2 examples from 2.0.7 html view:

<!-- modify the title via jscript -->
<script language="JavaScript" type="text/javascript">
//<![CDATA[
<cd:preserve whitespace="CL" /> mdocumenttitletext="Beit Rayim Synagogue and Hebrew School"
document.title="  "+mdocumenttitletext
//]]>
</script>
<!-- **** --><!-- modify the status bar text -->
<script language="JavaScript" type="text/javascript">
//<![CDATA[
<cd:preserve whitespace="CL" /> window.status = "Welcome to Beit Rayim's Website";
//]]>
</script>

What is <![CDATA[
<cd:preserve whitespace="CL" /> ? Do I really wanna know?

Indeed, the caveat is clear to perhaps wait for V2.0.9. So in the absence of a 2.0.7 solution, JOEL: please make my js work in v2.0.9.

Bob Bloom
Thursday, July 17, 2003

I'll work on fixing it. Thanks for trying the beta; if you hadn't tried this out and reported it we never would have found this bug.

For those who are really interested in the details:

The <![CDATA[ ... stuff is intentional and harmless, it's required to make your javascript also be valid xhtml -- part of the "generate clean valid xhtml" push.

See:

http://devedge.netscape.com/viewsource/2003/xhtml-style-script/

The <cd:preserve...> you see there is supposed to be a clue to CityDesk to put back a carriage return in case anyone takes it out. It's the secret whitespace preservation feature. But it shouldn't be showing up... it should have been replaced with a carriage return. It didn't because the whitespace restoration feature was confused by the < of the <![CDATA[  (sigh).

Joel Spolsky
Friday, July 18, 2003

By the way, if you go back and remove the <cd:preserve...> tags and leave the
//<![CDATA[
and
//]]>

intact, I think your JavaScript will start working again and will not be damaged again.

In other words change what you have to

<!-- modify the title via jscript -->
<script language="JavaScript" type="text/javascript">
//<![CDATA[
mdocumenttitletext="Beit Rayim Synagogue and Hebrew School"
document.title="  "+mdocumenttitletext
//]]>
</script>
<!-- **** --><!-- modify the status bar text -->
<script language="JavaScript" type="text/javascript">
//<![CDATA[
window.status = "Welcome to Beit Rayim's Website";
//]]>
</script>

and you'll be all ok.

Joel Spolsky
Friday, July 18, 2003

Joel, thanks for the tip. -Bob

Bob Bloom
Friday, July 18, 2003

Taking out the <cd:preserve...> tag works -- well, on most of the scripts. I'll have to go back and make sure there are no other funny tags.

So far, CD 2.0.7 doesn't reintroduce the <cd:...> tag after I delete it.

-Bob

Bob Bloom
Friday, July 18, 2003

*  Recent Topics

*  Fog Creek Home