Bug Tracker

Opened 10 years ago

Closed 10 years ago

#13592 closed bug (notabug)

Corrupt column text when create TD with more than 2 html tags

Reported by: anonymous Owned by: anonymous
Priority: undecided Milestone: None
Component: unfiled Version: 1.9.1
Keywords: Cc:
Blocked by: Blocking:


When add TD that contain more than 2 html tags, the TD content was corrupted. The first column in first row which include 2 tags (span and A) is display correctly. But when I add <br /> tag to the second row, the TD content was corrupted

In the example.


<!DOCTYPE html PUBLIC "-W3CDTD HTML 4.01 TransitionalEN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Insert title here</title> <script type="text/javascript" src="js/jquery/jquery-1.9.1.js"></script> <script type="text/javascript" src="NewFile.js"></script> </head> <body> <table border="1" id="a"> </table> <table style="display:none"> <tr id ="tpl_row">

<td><a href="#">Col1</a></td> <td> Col2 </td>


</table> </body> </html> --HTML--



function document_ready() {

var tbl = $("#a"); var row_tpl = $("#tpl_row");

var rows = [

["<span>Row1<span><A href=\"#\">Link1</A>","Ok"],

["<span>Row2<span><br/><A href=\"#\">Link2</A>","Error"],


for(var i in rows) {

var row = row_tpl.clone(); for(var k = 0; k <2; ++k) {

row.find(":nth-child(" + (k+1) + ")").html(rows[i][k]);





Change History (4)

comment:1 Changed 10 years ago by timmywil

Owner: set to anonymous
Status: newpending

Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket.

Additionally, be sure to test against the jQuery Edge version to ensure the issue still exists. To get you started, use this boilerplate: http://jsfiddle.net/FrKyN/. Open the link and click to "Fork" (in the top menu) to get started.

comment:2 Changed 10 years ago by scottgonzalez

Also, make sure to test with a doctype that will trigger standards mode; 4.01 Transitional with a system identifier triggers different modes in different browsers.

comment:3 Changed 10 years ago by anonymous

Status: pendingnew

Just add the test case to jsFiddle.


comment:4 Changed 10 years ago by dmethvin

Resolution: notabug
Status: newclosed

You're cloning an element with an ID, then reinjecting multiple copies into the document, creating an invalid document. Work out these issues with some helpful people on a forum and only file a bug when you've established there is a jQuery bug.

Note: See TracTickets for help on using tickets.