> To completely cover the latter, if you need to emit a JS string
containing > a literal "</script>" within a HTML SCRIPT block, you
manually split it > > and you're done.  

Still seems like duct tape-- but I agree that does seem to be the most
(and only?) appropriate way to handle it.

> If you think there is a bug in the docs, you should enter a comment
> to that effect.

Not a bug so much as an information deficiency.  I think these gotcha's
would be worth mentioning.  I went to add a comment to the CF7 docs, but
it appears someone beat me to it.

> However, I don't see how you can reasonably assume that 
> jsStringFormat would do anything about context-sensitive rules.

I did pose the question, but I do believe I have come to the conclusion
that jsstringformat should not be aware of its context.  That being
said, I wish the docs would officially mention it.  Take xmlformat() for
example.  Can't you put absolutely anything into it and not break your
XML?  Shouldn't you be able to feed _anything_ into htmleditformat() and
know that the results can safely be placed into a form field's value?
Why then, should people be expected to assume jsstringformat to be any
different?  It just seems like CF has a nice and tidy, bullet-proof way
of escaping strings for any possible scenario under the sun with the
glaring exceptions of this hardly documented behavior.  For this I have
to resort to manually kludging up by script tags and it just doesn't
feel right.


> Worth mentioning (for your comment) is that quotes cause a similar
issue
> with jsStringFormatted embedded within HTML tag event handlers.  You
need > to use htmlEditFormat (or whatever) to convert the JS to valid 
> HTML, because that's the context it's used in.

Hmm, good point. I had forgotten about that.  At least the answer here
should be bullet-proof as long as you do <tag
onlick="alert('#htmleditformat(jsstringformat(crazy_string))#');">  That
"feels right" to me. 

Thanks for the good input Barney.

~Brad

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:295636
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to