T.J. Crowder wrote:
> Hi,
> String#escapeHTML escapes HTML.  Double quotes, single quotes, and
> newlines are all valid in HTML, so IMHO it's out of scope for
> escapeHTML to escape them.  FWIW, I'd say the requirement you're
> describing is specific enough to you that you should probably just add
> it at your end.  For instance, if your JSON strings are delimited with
> double quotes, there's no need to escape single quotes (and vice
> versa).

I have already added proper gsubs to the resulting escaped string,
thanks for the tip.

I still cannot agree that this is specific to my project only.
I very often need to put some (unknown)string into elements attribute.
I used to do it by creating new Element() and using setAttribute(), 
which did not require escaping anything, but latest discusions about 
speed of innerHTML operation make me try this approach.
I still have to set attributes of the elements to different strings, 
and I cannot now if they contain quotes or not, so I need to escape 
them. I think than many people need to put strings inside element 
The JSON in attribute is probably more specific to my project.

Anyway, I know nothing can be done to the actual method, I just think 
the docs should have an example what to do in that case.

 > [...]
> If you create a lighthouse ticket, feel free to assign it to me.  I'd
> probably add something like this to the docs:
here it comes:

Thank you for your time.
Best Regards,

You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to