Side navigation
#11753 closed bug (invalid)
Opened May 11, 2012 03:40PM UTC
Closed May 11, 2012 04:23PM UTC
Text similar to html tags are considered as html tags - text() AND/OR replaceWith()
Reported by: | kmaheshbabu2002@gmail.com | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.7.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
This problem came up with a strange data which is similar to html tag eg., <form:0123>. Which actually denotes a identifier to the user. It appears like either text() or replaceWith() is handling this type of input wrongly.
In IE 8: The text prior to this identifier and the identifier is ignored and is not rendered.
In Firefox 12: The identifier <form:0123> is ignored and is not rendered.
Below is html code that I tried.
<html><head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.js"></script> </head> <body>
<textarea id="searchresultsdata1">Text prior to identifer,<b>text after b</b></textarea><br/>
<textarea id="searchresultsdata2">Text prior to identifer,<b:0123>text after b:0123</textarea><br/>
<textarea id="searchresultsdata3"> Text prior to identifer,<FORM:0123>text after FORM:0123</textarea>
<script>
var tableData1 = window.jQuery("#searchresultsdata1").text();
window.jQuery("#searchresultsdata1").replaceWith(tableData1);
var tableData2 = window.jQuery("#searchresultsdata2").text();
window.jQuery("#searchresultsdata2").replaceWith(tableData2);
var tableData3= window.jQuery("#searchresultsdata3").text();
window.jQuery("#searchresultsdata3").replaceWith(tableData3);
</script></body></html>
Output in Internet explorer 8:
Text prior to identifer,text after b
text after b:0123
text after FORM:0123
Output in Firefox 12.0:
Text prior to identifer,text after b
Text prior to identifer,text after b:0123
Text prior to identifer,text after FORM:0123
Attachments (0)
Change History (1)
Changed May 11, 2012 04:23PM UTC by comment:1
resolution: | → invalid |
---|---|
status: | new → closed |
The
.replaceWith()
method takes HTML, so your strings look like markup to it. You'll need to HTMLEncode the special characters. Since IE8 doesn't understand custom tags it's even worse there, but again it's already wrong so there's no guarantee of consistent output.