I followed Martin's hint and with wicket 6.7.0 I manually changed the replacement in the javascript from
jQuery(element).after($newElement).remove(); to jQuery(element).replaceWith($newElement); But I just saw, that in Github (https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js#L1617) "replaceWith" is now the standard replacement. Will this appear in Wicket 6.9.0? Best Nico Am 28.05.2013 um 21:12 schrieb Maxim Solodovnik [via Apache Wicket]: > I also saw this behavior using 6.8.0 > The component with additional id was replaced, but there was time period > when 2 components are present on page > > > On Wed, May 29, 2013 at 12:12 AM, Heikki Uotinen < > [hidden email]> wrote: > > > Hi, > > > > we had similar issue and could not find jira ticket for this, thus created > > WICKET-5210 with quickstart. > > > > Our workaround was changing our jQuery('#someid').. to > > jQuery('[id=someid]').. to match all same (two) ids. > > > > Rgds, > > Heikki > > > > -----Original Message----- > > From: Nico [mailto:[hidden email]] > > Sent: 15. toukokuuta 2013 11:07 > > To: [hidden email] > > Subject: Re:aj Component twice in markup while ax refresh in Wicket 6.7 > > (migrated from 1.5.10) > > > > Hi, > > > > thanks for you quick replies! I will create the quick start and attach it > > to a jira ticket. > > > > Thanks to your hint Martin, for the moment I will use jQuery#replaceWith() > > to make sure my app runs as expected. > > > > Best > > Nico > > > > > > Am 14.05.2013 um 16:56 schrieb Martin Grigorov-4 [via Apache Wicket]: > > > > > Hi, > > > > > > We use > > > https://github.com/apache/wicket/blob/master/wicket-core/src/main/java > > > /org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js#L1617 > > > because > > > it is faster than jQuery#replaceWith(). > > > So yes, there is a small period when both the old and the new are in > > > the DOM. > > > As Sven asked - please create a quicktart and attach it to a ticket so > > > we can see whether we will find a solution or we will have to use the > > > slower way to replace. > > > > > > > > > On Tue, May 14, 2013 at 4:48 PM, Sven Meier <[hidden email]> wrote: > > > > > > > Create a quickstart and attach it to a Jira issue please. > > > > > > > > Sven > > > > > > > > > > > > On 05/14/2013 04:37 PM, Nico wrote: > > > > > > > >> Hi > > > >> > > > >> I migrated my application from Wicket 1.5.10 to 6.7 > > > >> > > > >> During testing I recognized that during an ajax update > > > >> (replacement) of a component, the markup of the component is twice > > > >> in the HTML markup (the old and the new markup). Thus the execution > > > >> of javascript inside a component may fail due to the fact, that two > > > >> components with the same id are present in the HTML markup. > > > >> > > > >> EXAMPLE > > > >> > > > >> > > > >> *HTML:* > > > >> <a wicket:id="testlink"**>testlink</a> > > > >> <div wicket:id="testbox" style="width: 100px; > > height: > > > >> 100px; border: 1px solid #ccc;"> > > > >> <script type="text/javascript&**quot;> > > > >> alert('hello'); > > > >> </script> > > > >> </div> > > > >> > > > >> *JAVA:* > > > >> final WebMarkupContainer testbox = new > > > >> WebMarkupContainer("testbox"); testbox.setOutputMarkupId(**true); > > > >> add(testbox); > > > >> > > > >> add(new AjaxLink<Void>("testlink") { > > > >> private static final long serialVersionUID = 1L; > > > >> > > > >> @Override > > > >> public void onClick(AjaxRequestTarget target) { > > > >> target.add(testbox); > > > >> } > > > >> }); > > > >> > > > >> > > > >> So while the ajax update is processed the 'testbox' DIV and its > > > >> javascript are present twice (the old and new DIV). If the > > > >> javascript is a little more complex and for example changes stuff > > > >> inside the DIV, the javascript will change stuff in the old instead > > > >> of the new DIV container. > > > >> > > > >> My javascript relies on the fact, that an id should always be > > > >> present just once. > > > >> > > > >> Why is the old DIV not removed first, before the new DIV is > > > >> appended? Can I change this behavior somehow? > > > >> > > > >> Thanks in advance > > > >> Nico > > > >> > > > >> > > > >> > > > >> -- > > > >> View this message in context: http://apache-wicket.1842946.** > > > >> n4.nabble.com/Component-twice-**in-markup-while-ajax-refresh-** > > > >> in-Wicket-6-7-migrated-from-1-**5-10-tp4658789.html<http://apache-w > > > >> icket.1842946.n4.nabble.com/Component-twice-in-markup-while-ajax-re > > > >> fresh-in-Wicket-6-7-migrated-from-1-5-10-tp4658789.html> > > > >> Sent from the Users forum mailing list archive at Nabble.com. > > > >> > > > >> ------------------------------**------------------------------**--- > > > >> ------ To unsubscribe, e-mail: > > > >> users-unsubscribe@wicket.**apache.org<[hidden email]> For > > > >> additional commands, e-mail: [hidden email] > > > >> > > > >> > > > > > > > > ------------------------------**------------------------------**---- > > > > ----- To unsubscribe, e-mail: > > > > users-unsubscribe@wicket.**apache.org<[hidden email]> For additional > > > > commands, e-mail: [hidden email] > > > > > > > > > > > > > > > > > -- > > > Martin Grigorov > > > Wicket Training & Consulting > > > http://jWeekend.com <http://jweekend.com/> > > > > > > > > > If you reply to this email, your message will be added to the discussion > > below: > > > http://apache-wicket.1842946.n4.nabble.com/Component-twice-in-markup-w > > > hile-ajax-refresh-in-Wicket-6-7-migrated-from-1-5-10-tp4658789p4658791 > > > .html To unsubscribe from Component twice in markup while ajax refresh > > > in Wicket 6.7 (migrated from 1.5.10), click here. > > > NAML > > > > > > > > > > > > -- > > View this message in context: > > http://apache-wicket.1842946.n4.nabble.com/Component-twice-in-markup-while-ajax-refresh-in-Wicket-6-7-migrated-from-1-5-10-tp4658789p4658813.html > > Sent from the Users forum mailing list archive at Nabble.com. > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [hidden email] > > For additional commands, e-mail: [hidden email] > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [hidden email] > > For additional commands, e-mail: [hidden email] > > > > > > > -- > WBR > Maxim aka solomax > > > If you reply to this email, your message will be added to the discussion > below: > http://apache-wicket.1842946.n4.nabble.com/Component-twice-in-markup-while-ajax-refresh-in-Wicket-6-7-migrated-from-1-5-10-tp4658789p4659119.html > To unsubscribe from Component twice in markup while ajax refresh in Wicket > 6.7 (migrated from 1.5.10), click here. > NAML -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Component-twice-in-markup-while-ajax-refresh-in-Wicket-6-7-migrated-from-1-5-10-tp4658789p4659125.html Sent from the Users forum mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org