Couple points that seem to be bubbling up:
1) Kid is XML so '&' needs to be escaped &
2) In general practice it is good to keep all your _javascript_ in a .js static file if they it can reduce network usage becuase the static content can be reused. Take care not to keep specific functions that only apply to a single or a couple pages out of the global _javascript_ file.
3) If you have some page specific code that is easiest to put on the page use <!
[CDATA[....]]>. Page variables that are initialized, small simple functions or dynamic _javascript_.
4) As always the use of <!-- --> is advised for older browser compatability (ofcourse if your site is like mine, browsers that don't _javascript_ won't be able to use the site so no loss)

In my limited experience some web pages I couldn't figure out any other way then to generate _javascript_ on the page. If this was a limitation of _javascript_, my knowledge or my time, it didn't really matter.

I vote that this question go into the FAQ.






On 5/7/06, Robin Haswell <[EMAIL PROTECTED] > wrote:


> Using comments to wrap something that you want to keep in the document
> is a bad idea.  Sure, it might happen to work with Kid, but I still
> wouldn't do it or recommend it.

That technique has been recommended for JS since day 1. It's the standard way of hiding JS from
non-_javascript_-aware browser. You wrap it in a comment so if your user agent doesn't understand JS,
it doesn't go printing it everywhere.

Not that you should be putting JS in your <body/> though.

I'm fine with JS on-page when it only affects that page. Including it in a global JS file increases
bandwidth. Including it in its own external file causes connection overhead (in HTTP/1.0)

> -bob

-Rob





--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to