Namespace given space separated parameters if necessary (only * call this if there is a namingContainerPrefix!). This * function is here for backwards compatibility with manual * jsf.ajax.request() calls written before Spec790 changes.
* @param parameters Spaceseparated string of parameters as * usually specified in f:ajax execute and render attributes. * @param sourceClientId The client ID of the f:ajax * source. This is to be used for prefixing relative target * client IDs. * It's expected that this already starts with * namingContainerPrefix. * @param namingContainerPrefix The naming container prefix (the * view root ID suffixed with separator character). * This is to be used for prefixing absolute target client IDs. * @ignore */ var namespaceParametersIfNecessary = function namespaceParametersIfNecessary(parameters, sourceClientId, namingContainerPrefix) { if (sourceClientId.indexOf(namingContainerPrefix) != 0) { return parameters; // Unexpected source client ID; let's silently do nothing. } var targetClientIds = parameters.replace(/^\s+|\s+$/g, '').split(/\s+/g); for (var i = 0; i < targetClientIds.length; i++) { var targetClientId = targetClientIds[i]; if (targetClientId.indexOf(jsf.separatorchar) == 0) { targetClientId = targetClientId.substring(1); if (targetClientId.indexOf(namingContainerPrefix) != 0) { targetClientId = namingContainerPrefix + targetClientId; } } else if (targetClientId.indexOf(namingContainerPrefix) != 0) { var parentClientId = sourceClientId.substring(0, sourceClientId.lastIndexOf(jsf.separatorchar)); if (namingContainerPrefix + targetClientId == parentClientId) { targetClientId = parentClientId; } else { targetClientId = parentClientId + jsf.separatorchar + targetClientId; } } targetClientIds[i] = targetClientId; } return targetClientIds.join(' '); }; /** * Check if a value exists in an array * @ignore */ var isInArray = function isInArray(array, value) { for (var i = 0; i < array.length; i++) { if (array[i] === value) { return true; } } return false; }; /** * Evaluate JavaScript code in a global context. * @param src JavaScript code to evaluate * @ignore */ var globalEval = function globalEval(src) { if (window.execScript) { window.execScript(src); return; } // We have to wrap the call in an anon function because of a firefox bug, where this is incorrectly set // We need to explicitly call window.eval because of a Chrome peculiarity /** * @ignore */ var fn = function() { window.eval.call(window,src); }; fn(); }; /** * Get all scripts from supplied string, return them as an array for later processing. * @param str * @returns {array} of script text * @ignore */ var getScripts = function getScripts(str) { // Regex to find all scripts in a string var findscripts = /