Bug Tracker

Modify

Ticket #11753 (closed bug: invalid)

Opened 13 months ago

Last modified 13 months ago

Text similar to html tags are considered as html tags - text() AND/OR replaceWith()

Reported by: kmaheshbabu2002@… Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.2
Keywords: Cc:
Blocking: Blocked by:

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,&lt;b&gt;text after b&lt;/b&gt;</textarea><br/> <textarea id="searchresultsdata2">Text prior to identifer,&lt;b:0123&gt;text after b:0123</textarea><br/> <textarea id="searchresultsdata3"> Text prior to identifer,&lt;FORM:0123&gt;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

Change History

comment:1 Changed 13 months ago by dmethvin

  • Status changed from new to closed
  • Resolution set to invalid

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.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.