users@javaserverfaces-spec-public.java.net

[jsr372-experts mirror] Re: [jsr372-experts] Improvements for ajax update (related to Handling Focus after Ajax update)

From: <werner.punz_at_gmail.com>
Date: Fri, 17 Apr 2015 07:42:53 +0000 (UTC)

Hi sorry to interrupt here negatively, but

using the protocols attribute directives causes sideffects on the
javascript side for the component authors.

I will give a short writeup what the problem is.

Up until now component authors could rely on the elements being
replaced.
Now in case of following
node.addEventListener("event", function...

The event listeners were cleared up, and could be reset via a jsf ajax
event listener.

Now if we introduce the case of replacing the elements in one case and
just replacing some attributes in another case we get the behavior of
having cleared up the registered events just like we used to do and not
having them cleared up in another (from the outside) unpredictable
case.
In the worst case the event handlers stack up in the component because
they are registered over and over again on the javascript side.

The solution to this according to what I could find out is to clone and
replace the element just before the attribute is set, which is also not
really that good from a performance perspective and might fail in the
future (not sure if this clearing up of events during node.clone really
is a documented feature).

If this is just wanted to preserve the focus, then I think there are
other ways to do it properly (see my last mail regarding the topic)


Werner