Friday, March 18, 2005

Inline script documentation with comment hacking

I'm still in love with Tantek's extremely clever way to include HTML documentation for JavaScript code inside the same document using comment hacks.

The particular (and peculiar) sequence of SGML comments <!-- --> and C-style comments /* */ allow the document to be parsed as either HTML or JavaScript depending on the way it's imported into the document. Load the script with a SCRIPT element and it's interpreted as JavaScript, but load the script directly into the browser and it's displayed as glorious, technicolor HTML. One caveat: you must leave off the .js file extension so that IE will interpret the file as text/html when you drop it into a browser.

7 Comments:

At 8:57 PM, Blogger Unknown said...

You have good content on your blog keep up the good work

 
At 6:21 AM, Blogger HiiFii Webservices said...

I liked you Blog so much,so i also wanted to show you some good resourses on the net.
Learn to earn 90000$/Month
For which you may also see my Personal Website
Here.
and for a Personal Education Career Tools
free Study Database.
This site is for seeing the
Hifi Electronics.
And this is for
World Class Gadgets

 
At 11:47 PM, Blogger Web Worker said...

Well, you do have a good blog, full of comment spam, but then that is the way it is these days, comments are a great form of communication, but they've been abused more than once. As for me, I'm a writer and a traveller, and yes, I'll do a bit of shameless self-promotion, why not? I write for two site...

WebTravelCheap and SearchThePlanet

This allows me a bit of freedom to travel, observe and make some lunch money along the way, keep up the good work, and I say that mainly to the actual blogger and not all of the comments.

Live long, travel well and be happy.

 
At 1:41 AM, Blogger Oksana said...

Tea tree oil is a great remedy that will help you to get rid of adult acne. If you suffer from them, I advice to try it.

 
At 8:49 AM, Blogger Oksana said...

adult acne treatment
stress relief
weight loss exercises
tea party set

 
At 4:20 PM, Blogger - said...

By all hi!!!
I from Russia. I am sorry for my bad English!!!
At me the question because of what events occurs increase PR of a site?
At me on a site PR-2 why so happens...
http://zarobotay.blogspot.com/
Whether it influences search???

 
At 6:32 AM, Blogger Valery said...

Find more about adult acne treatment and
food and wine pairing.

 

Post a Comment

<< Home