You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Werner Punz (JIRA)" <de...@myfaces.apache.org> on 2010/05/03 15:30:58 UTC

[jira] Resolved: (MYFACES-2640) (JSF.js) Ajax Render component problem, replace with whole fragment not one element.

     [ https://issues.apache.org/jira/browse/MYFACES-2640?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Werner Punz resolved MYFACES-2640.
----------------------------------

    Fix Version/s: 2.0.1-SNAPSHOT
       Resolution: Invalid

Please for a check why this is the expected behavior for JSF 2.0 see

http://www.mail-archive.com/jsr-314-open@jcp.org/msg00010.html

And also what you can do about it is simply you can embed your element into a wrapping element with the identifier of clientId!

Also for further reference please check the detailed comments in this thread. Every change from the structure the EG has proposed in the mail thread above will cause mojarra to fail  on IE6 and myfaces to fail as well.

Also why this bug is invalid please check the section in the spec dealing with the update cycle!
<xsd:complexType name="partial-response-updateType">
<xsd:annotation>
<xsd:documentation>
The "update" element enables DOM elements matching the "id"
attribute to be updated with the contents of this element.
</xsd:documentation>
</xsd:annotation>
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="id" type="xsd:string" use="required"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>


which to me is a full replacement of what update sends!
Hence I am reverting my update changes now, but the new find code is helpful
so I will leave it in.




> (JSF.js) Ajax Render component problem, replace with whole fragment not one element.
> ------------------------------------------------------------------------------------
>
>                 Key: MYFACES-2640
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2640
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>    Affects Versions: 2.0.0-beta-3
>         Environment: tomcat 6.0.20 java (mac os x )
>            Reporter: Mark Li
>             Fix For: 2.0.1-SNAPSHOT
>
>   Original Estimate: 4h
>  Remaining Estimate: 4h
>
> after ajax submit, jsf.js will re-render some element depending on jsf.ajax.request({render:" some elements "});
> but this js code will cause some problem.
> jsf.js:
> myfaces._impl._util._Utils.replaceHtmlItem = function (request, context, itemIdToReplace, newTag, form) {
> ......
>                     var fragment = range.createContextualFragment(newTag);
>                     evalNode = item.parentNode.replaceChild(fragment, item)
> .....
> }
> sometime fragment will has more than one childNodes, or the childNode not has clientId, but the childNode of childNode has clientId.
> this will cause html unstable.
> Please fix it.
> this is my suggestion:
> myfaces._impl._util._Utils.replaceHtmlItem = function (request, context, itemIdToReplace, newTag, form) {
>            .............
>               Orginal:
>                     var fragment = range.createContextualFragment(newTag);
>                     evalNode = item.parentNode.replaceChild(fragment, item)
>               fix:
>                     var fragment = range.createContextualFragment(newTag);
>                     var replaceItem = myfaces._impl._util._Utils.findHtmlItemFromFragment(fragment, itemIdToReplace);
>                     if(replaceItem == null)replaceItem = fragment;
>                     evalNode = item.parentNode.replaceChild(replaceItem, item)
>        ..................
> }
>     myfaces._impl._util._Utils.findHtmlItemFromFragment = function(fragment, itemId){
>     	if(fragment.childNodes == null)
>     		return null;
>     	for(var i = 0; i < fragment.childNodes.length ; i++ ){
>     		var c = fragment.childNodes[i];
>     		if(c.id == itemId)
>     			return c;
>     	}
>     	for(var i = 0; i < fragment.childNodes.length ; i++ ){
>     		var c = fragment.childNodes[i];
>     		var item = myfaces._impl._util._Utils.findHtmlItemFromFragment(c, itemId);
>     		if(item != null)
>     			return item;
>     	}
>     	return null;
>     };

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