Bug Tracker

Modify

Ticket #7593 (closed bug: worksforme)

Opened 3 years ago

Last modified 3 years ago

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:
Blocking: Blocked by:

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

comment:1 Changed 3 years ago by rwaldron

  • Owner set to Ondrej.Fuxa@…
  • Status changed from new to pending
  • Component changed from unfiled to ajax

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

comment:2 Changed 3 years ago by jitter

  • Status changed from pending to closed
  • Resolution set to worksforme

 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

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.