Hi
Is there any reason, why the RichFaces built-in client functions (See Chapter 14. Functions), like rich:clientId('id') doesn't find the "closest" element with the given id, instead of searching from the root naming container, returning the first element with the given id? Or is there another way to access the needed "closest" element? It seems that most other things, resolve ids by starting at the closest NamingContainer, moving upwards by parent NamingContainers, searching for the relevant id in each NamingContainer until finally arriving at the root.
If, for example, I have a composition template test.xhtml:
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:rich="http://richfaces.org/rich"
xmlns:s="http://jboss.com/products/seam/taglib">
<s:div id="mydiv">
<ui:insert/>
</s:div>
Div ID: #{rich:clientId('mydiv')}
<script type="text/javascript">
#{rich:element('mydiv')}.style.background='red'
</script>
</ui:composition>
which I use to decorate some example text:
<s:decorate template="test.xhtml">
Text1
</s:decorate>
<s:decorate template="test.xhtml">
Text2
</s:decorate>
I would expect the output to look like
but instead it renders as
because both functions find the first div on the page with an id of "mydiv", instead of the "closest" (i.e. in the same NamingContainer).