With no indication of what either the 'parent' HTML structure or the JSON structure is like, is it possible to switch from ...
var $component = $(state.html); $component.appendTo(parent); ...to... $(parent).html(state.html); (You wouldn't need to empty parent first - html() does that for you) On Oct 13, 9:33 pm, koollx <[EMAIL PROTECTED]> wrote: > I can use PasteMonkey but I don't see how it can help in this case - > what exactly do you want me to paste in it? The line that takes over > 20 seconds to execute is the regexp applied to the HTML that's passed > to jQuery constructor. There is no point in editing HTML (I think) > because it is automatically generated by the server and is very > dynamic. I just pasted one example of it. There is no way to predict > all possible combinations of that HTML. > > The issue I think is in regexp, or IE performance when applying > regexp. The regexp is in jquery.js. > > Are you suggesting that the problem is in the HTML markup I'm trying > to insert into the page? > > On Oct 12, 7:12 pm, polyrhythmic <[EMAIL PROTECTED]> wrote: > > > Alex, > > > May I recommend to you PasteMonkey? > > >http://pastemonkey.org/ > > > Charles > > doublerebel.com > > > On Oct 12, 11:42 am, koollx <[EMAIL PROTECTED]> wrote: > > > > I'm trying to use jQuery 1.2.1 to add AJAX functionality to my web > > > application. I am using jQuery Form plugin to submit te form via AJAX > > > and have a server-side algorithm that returns page updates. The server > > > returns a JSON array with HTML elements to be updated and then I loop > > > through that array and process each item. For update, I first remove > > > the existing DOM element, then recreate it using jQuery constructor, > > > and then append it to the parent. It works find in FireFox, but in IE > > > the performance is horrendous. It takes 25 seconds in IE6 and IE7 > > > pretty much hangs. I traced the delay to the following line of code in > > > jQuery init method: > > > > var m = quickExpr.exec(selector); > > > > So it seems that jQuery is to blame for the performance. Is there > > > something I can do to improve it? Is this a bug/issue that needs to be > > > resolved? I'd like to help fix it but I'm not familiar with jQuery > > > design well enough to know why the regexp is there and how we can > > > simplify/remove it. Here's my update code: > > > > var $component = $(state.html); > > > $component.appendTo(parent); > > > > And the HTML that takes particularly long is pasted below (it may look > > > like a large page but it isn't. It loads into the browser without > > > jQuery AJAX in less then a second): > > > > <div id=\"JTabbedPane10546001\" style= > > > \"position:absolute;left:0px;top:46px;width:884px;height:644px\" > > > tabbedPane=\"true\"> > > > <ul> > > > <li><a href=\"#JTabbedPane10546001-tab-0\"><span>Button > > > Demo</span></a></li> > > > <li><a href=\"#JTabbedPane10546001-tab-1\"><span>Source > > > Code</span></a></li> > > > </ul> > > > <div id=\"JTabbedPane10546001-tab-0\" style= > > > \"position:absolute;left:2px;top:26px;width:874px;height:585px\"><div > > > id=\"JPanel12136681\" style=\"position:absolute;left:2px;top:1px;width: > > > 874px;height:611px;clip:rect(0px 874px 611px 0px)\" class=\" border\"> > > > <div id=\"JPanel14907335\" style= > > > \"position:absolute;left:2px;top:2px;width:874px;height: > > > 611px;clip:rect(0px 874px 611px 0px)\"> > > > <div id=\"JTabbedPane30196714\" style= > > > \"position:absolute;left:0px;top:0px;width:874px;height:611px\" > > > tabbedPane=\"true\"> > > > <ul> > > > <li><a href=\"#JTabbedPane30196714- > > > tab-0\"><span>Buttons</span></a></li> > > > <li><a href=\"#JTabbedPane30196714- > > > tab-1\"><span>Radio Buttons</span></a></li> > > > <li><a href=\"#JTabbedPane30196714- > > > tab-2\"><span>Check Boxes</span></a></li> > > > </ul> > > > <div id=\"JTabbedPane30196714-tab-0\" style= > > > \"position:absolute;left:2px;top:26px;width:868px;height:555px\"><div > > > id=\"JPanel5403403\" style=\"position:absolute;left:2px;top:1px;width: > > > 868px;height:581px;clip:rect(0px 868px 581px 0px)\"> > > > <div id=\"JPanel16702321\" style= > > > \"position:absolute;left:5px;top:5px;width:548px;height: > > > 567px;clip:rect(0px 548px 567px 0px)\" class=\" border\"> > > > <fieldset style=\"position:absolute;left: > > > 9px;top:8px;width:529px;height:61px;clip:rect(0px 549px 81px 0px)\" > > > class=\" border\"> > > > <legend>Text Buttons</legend> > > > <input type=\"button\" id= > > > \"JButton7715289\" name=\"JButton7715289\" value=\"One \" class= > > > \"button\" onClick=\"return doSubmit('/button/JButton7715289')\" style= > > > \"position:absolute;left:11px;top:21px;width:69px;height:27px\"> > > > <span style=\"font-size:1;width: > > > 10;position:absolute;left:80px;top:34px;width:11px;height:1px > > > \"> </span> > > > <input type=\"button\" id= > > > \"JButton5689693\" name=\"JButton5689693\" value=\"Two\" class=\"button > > > \" onClick=\"return doSubmit('/button/JButton5689693')\" style= > > > \"position:absolute;left:92px;top:21px;width:66px;height:27px\"> > > > <span style=\"font-size:1;width: > > > 10;position:absolute;left:158px;top:34px;width:11px;height:1px > > > \"> </span> > > > <table border=0 cellpadding=2 > > > cellspacing=0 class=\"button\" onclick=\"return doSubmit('/button/ > > > JButton7083822')\" id=\"JButton7083822\" style=\"border-width: > > > 1px;border-style:outset;position:absolute;left:170px;top:22px;width: > > > 351px;height:25px\"> > > > <tr> > > > <td align=center> > > > <table border=0 cellpadding=2 > > > cellspacing=0> > > > <tr> > > > <td><span><font size=2 > > > color=red><bold>Three!</font></span></td> > > > </tr> > > > </table> > > > </td> > > > </tr> > > > </table> > > > </fieldset> > > > <span style=\"font-size:30;width: > > > 1;position:absolute;left:9px;top:73px;width:1px;height:31px\"> </ > > > span> > > > <fieldset style=\"position:absolute;left: > > > 9px;top:105px;width:410px;height:114px;clip:rect(0px 430px 134px 0px) > > > \" class=\" border\"> > > > <legend>Image Buttons</legend> > > > <a href=\"#\" onclick=\"return doSubmit('/ > > > button/JButton6676137')\"><img src=\"http://localhost:8040/webcream/ > > > Windows_docs/images/resources/images/buttons/b1.gif\" alt=\"\" title= > > > \"\" style=\"position:absolute;left:5px;top:16px\" border=0></a> > > > <span style=\"font-size:1;width: > > > 10;position:absolute;left:132px;top:61px;width:11px;height:1px > > > \"> </span> > > > <a href=\"#\" onclick=\"return doSubmit('/ > > > button/JButton18285669')\"><img src=\"http://localhost:8040/webcream/ > > > Windows_docs/images/resources/images/buttons/b2.gif\" alt=\"\" title= > > > \"\" style=\"position:absolute;left:143px;top:16px\" border=0></a> > > > <span style=\"font-size:1;width: > > > 10;position:absolute;left:270px;top:61px;width:11px;height:1px > > > \"> </span> > > > <a href=\"#\" onclick=\"return doSubmit('/ > > > button/JButton26899046')\"><img src=\"http://localhost:8040/webcream/ > > > Windows_docs/images/resources/images/buttons/b3.gif\" alt=\"\" title= > > > \"\" style=\"position:absolute;left:281px;top:16px\" border=0></a> > > > </fieldset> > > > <span style=\"font-size:0;width: > > > 0;position:absolute;left:8px;top:213px;width:0px;height:323px > > > \"> </span> > > > </div> > > > <span style=\"font-size:0;width: > > > 0;position:absolute;left:485px;top:5px;width:0px;height:0px\"> </ > > > span> > > > <div id=\"_133097577\" style= > > > \"position:absolute;left:557px;top:5px;width:303px;height: > > > 571px;clip:rect(0px 303px 571px 0px)\"> > > > <div id=\"JPanel13419753\" style= > > > \"position:absolute;left:0px;top:0px;width:299px;height: > > > 567px;clip:rect(0px 299px 567px 0px)\" class=\" border\"> > > > <div id=\"JPanel26452617\" style= > > > \"position:absolute;left:9px;top:8px;width:116px;height: > > > 252px;clip:rect(0px 116px 252px 0px)\"> > > > <span id=\"JLabel18384844\" style=\"text- > > > align:left;position:absolute;left:0px;top:0px;width:104px;height:16px > > > \" class=\"label\"><nobr>Display Options:</nobr></span> > > > <span id=\"JCheckBox32263490\" style= > > > \"text-align:left;position:absolute;left:0px;top:16px;width: > > > 110px;height:25px\" class=\"checkbox\"><input type=\"checkbox\" id= > > > \"JCheckBox32263490\" name=\"JCheckBox32263490\" class=\"checkbox\" > > > checked onClick=\"doSubmit('/event/JCheckBox32263490')\">Paint Border</ > > > span> > > > <span id=\"JCheckBox12860026\" style= > > > \"text-align:left;position:absolute;left:0px;top:42px;width: > > > 104px;height:25px\" class=\"checkbox\"><input type=\"checkbox\" id= > > > \"JCheckBox12860026\" name=\"JCheckBox12860026\" class=\"checkbox\" > > > checked onClick=\"doSubmit('/event/JCheckBox12860026')\">Paint Focus</ > > > span> > > > <span id=\"JCheckBox14375014\" style= > > > \"text-align:left;position:absolute;left:0px;top:67px;width: > > > 80px;height:25px\" class=\"checkbox\"><input type=\"checkbox\" id= > > > \"JCheckBox14375014\" name=\"JCheckBox14375014\" class=\"checkbox\" > > > checked onClick=\"doSubmit('/event/JCheckBox14375014')\">Enabled</ > > > span> > > > <span id=\"JCheckBox8952636\" style= > > > \"text-align:left;position:absolute;left:0px;top:92px;width: > > ... > > read more ยป