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 attributes. 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: http://prototype.lighthouseapp.com/projects/8886-prototype/tickets/722-escapehtml-underdocumented-note-about-quotes-needed Thank you for your time. Best Regards, SWilk --~--~---------~--~----~------------~-------~--~----~ 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 email@example.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---