- This topic has 6 replies, 2 voices, and was last updated 10 years, 10 months ago by rick.gommers.
-
AuthorPosts
-
rick.gommersMemberHi all,
I have the following code in my app:
"<td><img src="images/potlood-wijzig.png" /></td>"+
I use the " ascii code to prevent breaking the html parser in javascript. This is according to the guidelines on this site: http://www.ascii.cl/htmlcodes.htm
MobiOne however, descides to enter 2 “” when using this ascii code. See the source of my app (image taken from simulator source):
Could you change this for me so MobiOne works according to the ascii guidelines and enters only one ” ?
Thx in advance!
support-octavioMemberHi marcoevich,
I have opened an enhancement bug for this, in the meantime the workaround is not to use the ascii code for the quotes.
rick.gommersMemberHi Ocatvio,
Thx for the update.
Do you have an idea when such enhancement could be in place?
support-octavioMemberHi marcoevich,
Could you please share a sample project that demonstrate the issue so we can investigate it quickly?
rick.gommersMemberHi octavio,
Well, let me start by noting that I’ve solved my initial problem.
When this problem occurred I didn’t think of the possibility to use single quotes.
This problem..
"<td><img src="images/potlood-wijzig.png" /></td>"+
..can be fixed by using single quotes inside the double quotes, like so:
"<td><img src='images/potlood-wijzig.png' /></td>"+
However I still think that you should follow the ascii table rule of parsing only a single ” or ‘ when using " and ' notation. That will provide us with another method of adding classes and variables etc using javascript, in case single quotes won;t work. So good to see you’re working on it 🙂
I’ve created an example for you that you can download here: https://dl.dropboxusercontent.com/u/15584788/QuotestTest.zip
Click the generate table button. You should see a table being generated with 2 fields with a value and a placeholder in it. These value and placeholder contain double ” if you look at the source code. This result in the quotes being visible in the fields.
Also, look at the id of the <tr>. It’s impossible to retrieve an id that looks like this:
<tr id="'item01'"
If you see what I see, then you notice that the html ascii code for single quotes ( ' ) also parses a double quote…
Thank you for looking into this 😉
support-octavioMemberHi marcoevich,
I have recieved feedback from the dev team: HTML codes are NOT valid inside JS strings, so, f.e.
("#aa").append( "<tr id='item0"+3+"'>"+ "<td><img src="images/potlood-wijzig.png" /></td>" + "</tr>");
Here " is parsed as a part of src attribute value, this is a behaviour that is not related neither to Mobione nor to even jQuery, the same could be reproduced with pure JS and DOM. An alternative is that JS allows to have quotes inside quoted strings through prefixing them by \
Example:
("#aa").append( "<tr id=\"item0"+3+"\">"+ "<td><img src=\"images/potlood-wijzig.png\" /></td>" + "</tr>");
rick.gommersMemberHi Octavio,
Thx a lot for the clarification! I didn’t know that ascii codes where not accepted in js strings.
I’ll learn something more every day 🙂
Thx again!
-
AuthorPosts