This should be possible according to JavaScript Functions in Selenium IDE HTML Tests:
<tr>
<td>storeEval</td>
<td>function(input) {return input.replace('foo', 'bar');}</td>
<td>replaceText</td>
</tr>
<tr>
<td>storeEval</td>
<td>replaceText('foo')</td>
<td>var</td>
</tr>
Instead I get the following exception:
function statement requires a name
After giving it a name the statement runs:
<tr>
<td>storeEval</td>
<td>function replaceText(input) {return input.replace('foo', 'bar');}</td>
<td>replaceText</td>
</tr>
But the next line fails to find the definition:
replaceText is not defined
I've also tried referencing the variable instead of the function:
<tr>
<td>storeEval</td>
<td>${replaceText}('foo')</td>
<td>var</td>
</tr>
But apparently it's still undefined:
null is not a function
I also tried making an anonymous function:
<tr>
<td>storeEval</td>
<td>(function (input) {return input.replace('foo', 'bar')})</td>
<td>replaceText</td>
</tr>
and running it with parentheses:
<tr>
<td>storeEval</td>
<td>(${replaceText})('foo')</td>
<td>var</td>
</tr>
Error:
missing ) in parenthetical
and without:
<tr>
<td>storeEval</td>
<td>${replaceText}('foo')</td>
<td>var</td>
</tr>
Error:
missing ; before statement