chat-bubble icon indicating copy to clipboard operation
chat-bubble copied to clipboard

single quotes in answers

Open jbkeg opened this issue 7 years ago • 5 comments
trafficstars

if there is a single quote in prefixed reply question it occurred error with "Uncaught SyntaxError: missing ) after argument list" on questionsHTML

ie) if the answer is "i don't care" or else rest of chat will be stops with javascript error

jbkeg avatar Jul 27 '18 10:07 jbkeg

You can escape single quotes like this: \’

Edit: with your example you'll need to type your answer out like this: "i don\'t care"

dmitrizzle avatar Jul 27 '18 15:07 dmitrizzle

but still occurs same issues

this issues can be solved by using javascript escape function using escape(el.question) and escape(el.answer) in bubbles.js

jbkeg avatar Jul 30 '18 07:07 jbkeg

@jbkeg Can you show me an example snippet of your code? I'd like to try and find out why it may occur.

The escape function might be an interesting way of dealing with these kinds of issues. If you'd like to submit a PR, I'll do some testing on it to see if it can be safely implemented.

dmitrizzle avatar Jul 30 '18 20:07 dmitrizzle

I can confirm "i don\'t care" does not work.

See https://codepen.io/sabatale/pen/XWebMzM.

sabatale avatar Dec 02 '21 17:12 sabatale

Thanks for the sample, @sabatale ! I'm gonna reopen this since this is now a replicable issue.

For now, I suggest you try curly apostrophes: ’ instead of '.

dmitrizzle avatar Dec 03 '21 17:12 dmitrizzle