You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Ali Ok <al...@aliok.com.tr> on 2010/06/02 01:18:52 UTC

onclick,onmouseover etc. pass thru properties on : MyFaces vs. Mojarra

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?

I couldn't find anything about onclick, onmouseover, etc. of <h:outputText>
in
* 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

Re: onclick,onmouseover etc. pass thru properties on : MyFaces vs. Mojarra

Posted by Matthias Wessendorf <ma...@apache.org>.
On Wed, Jun 2, 2010 at 9:57 AM, Ali Ok <al...@aliok.com.tr> wrote:
> Hi,
>>
>> that's right, not there. It's a (very) simple component.
>
> Some of the other components have this situation too, like:
> * h:commandButton -> align
> * h:inputText -> checked (doesn't make sense)
> * ...
>>
>> 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.
>
> Yes, and I can say they are good and necessary :) But I wish they were
> defined in some place.

well, the reason was to keep <h:outputText> tiny and simple.

> The reason I asked this is, decision of using this approach in hx
> components.
> I understood that it would be better if I add "solid" fields for this kind
> of attributes to expose at IDEs and taglib doc, since I don't have any spec
> to follow :)

on tomahawk and trinidad we have those extra attributes, which is totally fine
to have that on your hx:... as well

> Thanks,
> On Wed, Jun 2, 2010 at 9:51 AM, Matthias Wessendorf <ma...@apache.org>
> wrote:
>>
>> 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
>
>
>
> --
> 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

Re: onclick,onmouseover etc. pass thru properties on : MyFaces vs. Mojarra

Posted by Ali Ok <al...@aliok.com.tr>.
Hi,

that's right, not there. It's a (very) simple component.

Some of the other components have this situation too, like:
* h:commandButton -> align
* h:inputText -> checked (doesn't make sense)
* ...

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.


Yes, and I can say they are good and necessary :) But I wish they were
defined in some place.

The reason I asked this is, decision of using this approach in hx
components.
I understood that it would be better if I add "solid" fields for this kind
of attributes to expose at IDEs and taglib doc, since I don't have any spec
to follow :)

Thanks,

On Wed, Jun 2, 2010 at 9:51 AM, Matthias Wessendorf <ma...@apache.org>wrote:

> 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
>



-- 
My Blog: http://blog.aliok.com.tr
Twitter: http://twitter.com/aliok_tr

Re: onclick,onmouseover etc. pass thru properties on : MyFaces vs. Mojarra

Posted by Matthias Wessendorf <ma...@apache.org>.
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