Closed GoogleCodeExporter closed 9 years ago
I found the issue in line 831.
The quoting is completely wrong there. Therefore browsers will try to interpret
the input themselves.
Here is the corrected line:
var $input = $('<input '+maxlength+' class="editableInput '+xtraClass+'"
type="text" value="' + $td.text() + '"/>');
You have to swap double for single quotes and vice versa. Attributes are to be
double quoted in html mind you!
Original comment by mcl...@spaceweb.nl
on 7 Jun 2011 at 12:12
This makes it so you can have double quotes either. I'm going to leave it the
way I had it and just escape both possibilities.
so
var text = $td.text().replace(/"/g,"\"").replace(/'/g,"\'");
and use text instead of $td.text();
Original comment by Seancla...@gmail.com
on 5 Jul 2011 at 4:53
you know what. That doesn't fix it. I see why you did that. It still holds a
double quote problem.
Using yours and this replaces fixes it.
var text = $td.text().replace(/"/g,""");
var $input = $('<input '+maxlength+' class="editableInput '+xtraClass+'"
type="text" value="' + text + '"/>');
Original comment by Seancla...@gmail.com
on 5 Jul 2011 at 5:03
Original comment by Seancla...@gmail.com
on 5 Jul 2011 at 5:06
In fact, I found a much better way to solve this issue, that arises because of
the double quotes, but I rejected that after I discovered the single quotes,
that are just invalid. I thought I had solved it after rejecting the single
quotes, but realized only later I was wrong because of double quotes.
What you can do is much simpler. Do not put the value in when you create
$input. Create $input without the value, and after that, do $($input)val(val);
Where val is a variable that holds the value. That way, you have no problem
with any content, because jQuery will handle all possible escaping scenarios
for you.
Original comment by mcl...@spaceweb.nl
on 5 Jul 2011 at 7:39
haha wow. I kind of feel like an idiot for not seeing that.
var $input = $('<input '+maxlength+' class="editableInput '+xtraClass+'"
type="text" />');
$input.val($td.text());
Original comment by Seancla...@gmail.com
on 5 Jul 2011 at 3:35
Original comment by Seancla...@gmail.com
on 20 Jul 2011 at 3:15
Original issue reported on code.google.com by
mcl...@spaceweb.nl
on 7 Jun 2011 at 10:39