Bug Tracker

Opened 8 years ago

Closed 8 years ago

#7593 closed bug (worksforme)

Bug in html() in jQuery 1.4.x (ok in jQuery 1.3,2)

Reported by: Ondrej.Fuxa@… Owned by: Ondrej.Fuxa@…
Priority: undecided Milestone: 1.5
Component: ajax Version: 1.4.4
Keywords: Cc:
Blocked by: Blocking:

Description

Hello, I have application based on jQuery 1.3.2 and I want to load new jQuery but I find problem in new release. I load part of HTML that contains FORM element by AJAX. But in new release of jQuery the part of HTML is truncated. Example of my code:

var html = $.ajax({

url: DB_NAME_PRODUKTY + "/menu.html?OpenPage", async: false

}).responseText; NOW IT IS OK

$("#pcModalDialog2").html(html);

NOW THE VAR HTML IS TRUNCATED

AFTER I put HTML to DIV the HTML element FORM is truncated. $.ajax return this:

<div class="roundedcornr_top"><div></div></div>

<div class="roundedcornr_content">

<form name="menu">

<input name="username" value="" type="hidden"> <table>

<tr><td id="pcExtendedTableTitle">Nastavení produktového navigačního menu</td></tr> <tr><td><input checked type="radio" name="menu" value="standard" /> Standardní menu<br/><input type="radio" name="menu" value="filesystem" /> Stromové menu</td></tr> <tr>

<td align="center">

<input type="button" value="Potvrdit" onClick="setMenuTyp()">&nbsp; <input type="button" value="Zavřít" onClick="modalBgImgPK(false,'pcModalDialog2');">

</td>

</tr>

</table>

</form>

</div>

<div class="roundedcornr_bottom"><div></div></div>

but after I insert this HTML to DIV I have only this:

<div class="roundedcornr_top"><div></div></div>

<div class="roundedcornr_content">

<input name="username" value="" type="hidden"> <table>

<tbody><tr><td id="pcExtendedTableTitle">Nastavení produktového navigačního menu</td></tr> <tr><td><input checked="checked" name="menu" value="standard" type="radio"> Standardní menu<br><input name="menu" value="filesystem" type="radio"> Stromové menu</td></tr> <tr>

<td align="center">

<input value="Potvrdit" onclick="setMenuTyp()" type="button">&nbsp; <input value="Zavřít" onclick="modalBgImgPK(false,'pcModalDialog2');" type="button">

</td>

</tr>

</tbody></table>

</div>

<div class="roundedcornr_bottom"><div></div></div>

In jQuery 1.3.2 is everything OK.

Change History (2)

comment:1 Changed 8 years ago by Rick Waldron

Component: unfiledajax
Owner: set to Ondrej.Fuxa@…
Status: newpending

Please provide a reduced test case at http://jsfiddle.net - Thanks!

comment:2 Changed 8 years ago by jitter

Resolution: worksforme
Status: pendingclosed

test case reproduced from the horrible html blob you pasted into the ticket. Works for me.

The html you provided is invalid and that's most likely the cause for the problems you are experiencing. Also you should consider not doing async: false and $.ajax({...}).responseText but instead use the success callback for this.

If you feel this ticket was incorrectly closed or the bug still persists for you with the newest jQuery version, feel free to report back with a reduced and reproducible test on http://jsfiddle.net and request to reopen the issue.


How to report bugs

Note: See TracTickets for help on using tickets.