You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Jeremy Thomerson <je...@wickettraining.com> on 2012/08/16 17:26:56 UTC

Wicket 1.5 - duplicate JS detection broken?

I haven't had time to dig into this, but has anyone else seen where
duplicate JS detection is broken in 1.5.x?  For instance, add this twice in
your page:

      add(new AbstractDefaultAjaxBehavior() {
         @Override
         protected void respond(AjaxRequestTarget target) {
         }

         @Override
         public void renderHead(Component component, IHeaderResponse
response) {
            super.renderHead(component, response);
            response.renderJavaScript("function foo() { wicketAjaxGet('" +
getCallbackUrl() + "'); }", "foo-func");
         }
      });

I end up with two JS blocks in the output, both with the ID foo-func.
 Since I provided an ID that was the same for both behaviors, Wicket should
have only rendered one of those, right?

I hope to have time to debug next week if others confirm they've seen this
and I'm not missing something simple due to sleep deprivation :)

-- 
Jeremy Thomerson
http://wickettraining.com
*Need a CMS for Wicket?  Use Brix! http://brixcms.org*

Re: Wicket 1.5 - duplicate JS detection broken?

Posted by Martin Grigorov <mg...@apache.org>.
On Thu, Aug 16, 2012 at 6:26 PM, Jeremy Thomerson
<je...@wickettraining.com> wrote:
> I haven't had time to dig into this, but has anyone else seen where
> duplicate JS detection is broken in 1.5.x?  For instance, add this twice in
> your page:
>
>       add(new AbstractDefaultAjaxBehavior() {
>          @Override
>          protected void respond(AjaxRequestTarget target) {
>          }
>
>          @Override
>          public void renderHead(Component component, IHeaderResponse
> response) {
>             super.renderHead(component, response);
>             response.renderJavaScript("function foo() { wicketAjaxGet('" +
> getCallbackUrl() + "'); }", "foo-func");
>          }
>       });
>
> I end up with two JS blocks in the output, both with the ID foo-func.
>  Since I provided an ID that was the same for both behaviors, Wicket should
> have only rendered one of those, right?

Right.
This is a bug if it really happens.

>
> I hope to have time to debug next week if others confirm they've seen this
> and I'm not missing something simple due to sleep deprivation :)
>
> --
> Jeremy Thomerson
> http://wickettraining.com
> *Need a CMS for Wicket?  Use Brix! http://brixcms.org*



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com