[ 
https://issues.apache.org/jira/browse/MYFACES-2599?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12845280#action_12845280
 ] 

Werner Punz commented on MYFACES-2599:
--------------------------------------

Ok I have comitted everything that a detachment case is doable under certain 
conditions. Have in mind I am bending the spec here a little bit.
First of all, if the element is replaced with an element with the same 
identifier within a form, we are set and can pass through.
This would even pass through with the old code.

Second if the element is passed as domNode but the replacement has happend by a 
named element of the same name as the original identifier and no other equally 
named element under a form exists, we have case 1 here again, we do not have to 
do anything.

Now to the difficult cases, if the element is detached a and replaced by an 
element with a different identifier and same name and to the worse only the 
identifier string is passed down to jsf.ajax.request, which is probably the 
most common usecase:

This passes if only one element under a form with the same name , otherwise I 
cannot determine the source of the ajax request anymore and I am absolutely 
forced to throw an error (have in mind the id -> naming assumption is already a 
bending of the spec which clearly says If the DOM element could not be 
determined, throw an error, I assume having a matching name and only one within 
the bounds of a form
is valid within the spec.



> ajax javascript checks for existence of triggering html element
> ---------------------------------------------------------------
>
>                 Key: MYFACES-2599
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2599
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>    Affects Versions: 2.0.0-beta-2
>         Environment: Javascript
>            Reporter: Ganesh Jung
>
> This one is a bit special. I remove the triggering element from the DOM, 
> afterwards I trigger it's onchange method. Works with Mojarra, but MyFaces 
> insists, that the triggering element must exist in the DOM, though this isn't 
> necessary from the spec.
>               <h:form id="testForm">
>                       <h:inputText id="test" value="#{myBean.test}" >
>                               <f:ajax render="test2"/>
>               </h:inputText>
>                       <h:inputText id="test2" value="#{myBean.test}" />
>                   <script type="text/javascript">
>                               //<![CDATA[
>                       var myTest = document.getElementById("testForm:test");
>                       var test_onchange = myTest.onchange;
>                       myTest.parentNode.removeChild(myTest);
>                       test_onchange();
>                               //]]>
>                       </script>
>               </h:form>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to