On Wed, Jun 2, 2010 at 1:18 AM, Ali Ok <al...@aliok.com.tr> wrote: > Hi, > I see onclick, onmouseover, etc. attributes of <h:outputText> are passed > thru and rendered. > For: > <h:outputText id="..." value="test" onclick="alert('click');" .../> > I got this with MyFaces 2: > <span id="..." onclick="alert('click');" >test</span> > However, Mojarra ignores 'onclick': > <span id="..." >test</span> > HtmlTextRenderer[0] of MyFaces, which extends HtmlTextRendererBase, > renders[1] pass thru attributes of HTML.COMMON_PASSTROUGH_ATTRIBUTES[2]; > while Mojarra ignores onclick on <h:outputText>. > Is it OK to pass thru some attributes that are not defined in the spec?
since <h:outputText> is very simple (one reason why it is not a ClientBehaviorHolder), it's correct to ignore those attributes... I am actually surprised that something like this is not triggered by the TCK On the other hand, it does not cause big issues, other than blowing up the markup, which is expected if you are specifying things like the above attrs. > I couldn't find anything about onclick, onmouseover, etc. of <h:outputText> > in that's right, not there. It's a (very) simple component. > * JSF spec > * JSF Spec Facelet Taglib doc > : https://javaserverfaces.dev.java.net/nonav/docs/2.0/vdldocs/facelets/h/outputText.html > * JSF Spec RenderKit > doc: https://javaserverfaces.dev.java.net/nonav/docs/2.0/renderkitdocs/HTML_BASIC/javax.faces.Outputjavax.faces.Text.html > * JSF Spec > JavaDoc: http://java.sun.com/javaee/javaserverfaces/2.0/docs/api/javax/faces/component/html/HtmlOutputText.html > > [0] http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/renderkit/html/HtmlTextRenderer.java?view=markup > [1] http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlTextRendererBase.java?view=markup line > 127 > [2] http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HTML.java?view=markup line > 154 > BTW, as you can see this is not something special to <h:outputText>. Most > components have this issue. > Regards, > Ali > -- > My Blog: http://blog.aliok.com.tr > Twitter: http://twitter.com/aliok_tr > > -- Matthias Wessendorf blog: http://matthiaswessendorf.wordpress.com/ sessions: http://www.slideshare.net/mwessendorf twitter: http://twitter.com/mwessendorf