Details
Description
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++ )
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;
};