Hi, On Wed, Jun 3, 2015 at 4:32 PM, mashleyttu <[email protected]> wrote:
> Our application uses jQuery.noConflict changing all references from $ to > $j. > We are trying to integrate Wicket Atmosphere into our application, however, > are running into an issue where it is rendering a $ in an > OnDomReadyHeaderItem.forScript. This is of course causing javascript > errors. > > We have tracked it down to the renderHead method of AtmosphereBehavior. The > $ is hard coded in the javascript string. > > Does anyone know if it is possible to extend AtmosphereBehavior and have > Wicket Atmosphere use our custom version? > Nope See https://github.com/apache/wicket/blob/2f0d08d4179af272e1670084ec2e36f58628ff13/wicket-experimental/wicket-atmosphere/src/main/java/org/apache/wicket/atmosphere/AtmosphereEventSubscriptionCollector.java#L117 > > Or it is possible to extend OnDomReadyHeaderItem which would do a replace > on > $( with $j( and have wicket use that globally? > There is a way! You can register custom IHeaderResponseDecorator that will re-write the content of OnDomReadyHeaderItem when its script contains "$(". See http://wicketinaction.com/2012/07/wicket-6-resource-management/ https://github.com/l0rdn1kk0n/wicket-bootstrap/blob/3e6952567976302ed0698de1b52508fc7747e001/bootstrap-samples/src/main/java/de/agilecoders/wicket/samples/WicketApplication.java#L139 https://github.com/l0rdn1kk0n/wicket-bootstrap/blob/3e6952567976302ed0698de1b52508fc7747e001/bootstrap-core/src/main/java/de/agilecoders/wicket/core/markup/html/RenderJavaScriptToFooterHeaderResponseDecorator.java#L81 https://github.com/apache/wicket/blob/2f0d08d4179af272e1670084ec2e36f58628ff13/wicket-core/src/main/java/org/apache/wicket/markup/head/filter/FilteringHeaderResponse.java#L172 Here you have to do: @Override public void render(HeaderItem item) { if (item instanceof ondomreadyitem && ondomreadyitem.getScript().contains("$(")) {super.render(OnDomReadyHeaderItem.forScript(item.getScript().replaceAll("$(", "jQuery(")))} > > Any thoughts on how to resolve this issue? Using Wicket Atmosphere .18 and > Wicket 6.11 currently. > Please file a ticket so this is fixed for 6.20. Thanks! > > Thanks, > Matt > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/Wicket-Atmosphere-jQuery-noConflict-tp4671046.html > Sent from the Users forum mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
