Return-Path: Delivered-To: apmail-myfaces-dev-archive@www.apache.org Received: (qmail 78351 invoked from network); 6 Apr 2010 02:34:52 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 6 Apr 2010 02:34:52 -0000 Received: (qmail 10852 invoked by uid 500); 6 Apr 2010 02:34:51 -0000 Delivered-To: apmail-myfaces-dev-archive@myfaces.apache.org Received: (qmail 10744 invoked by uid 500); 6 Apr 2010 02:34:51 -0000 Mailing-List: contact dev-help@myfaces.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "MyFaces Development" Delivered-To: mailing list dev@myfaces.apache.org Received: (qmail 10737 invoked by uid 99); 6 Apr 2010 02:34:51 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Apr 2010 02:34:51 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Apr 2010 02:34:48 +0000 Received: from brutus.apache.org (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 3F062234C4A8 for ; Tue, 6 Apr 2010 02:34:27 +0000 (UTC) Message-ID: <906486494.707351270521267257.JavaMail.jira@brutus.apache.org> Date: Tue, 6 Apr 2010 02:34:27 +0000 (UTC) From: "Mark Li (JIRA)" To: dev@myfaces.apache.org Subject: [jira] Issue Comment Edited: (MYFACES-2640) (JSF.js) Ajax Render component problem, replace with whole fragment not one element. In-Reply-To: <334855626.650281270175787184.JavaMail.jira@brutus.apache.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/MYFACES-2640?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12853680#action_12853680 ] Mark Li edited comment on MYFACES-2640 at 4/6/10 2:32 AM: ---------------------------------------------------------- ok, I give some examples. just like i extend h:inputtext and add some prefix or suffix symbols enclosing the orginal inputtext codes. or extend h:form to a jquery dialog. and etc. if fragment must have only one root which must have the clientid, it will make the components extension very difficult. And yes, i dont like recursively method too. before I find out a better search fragment method or you fix it :-) , i will use these codes. I just want my work to move on. thx Mark was (Author: puddlor): ok, I give some examples. just like i extend h:inputtext and add some prefix or suffix symbols enclosing the orginal inputtext codes. or extend h:form to a jquery dialog. and etc. if fragment must have only one root which must have the clientid, it will make the components extension very difficult. And yes, i dont like recursively method too. before I find out a better search fragment method, i will use these codes. I just want my work to move on. thx Mark > (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 > 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.