jsr344-experts@javaserverfaces-spec-public.java.net

[jsr344-experts] Re: passThroughAttributes

From: Andy Schwartz <andy.schwartz_at_oracle.com>
Date: Mon, 25 Mar 2013 21:35:08 -0400

Hey Kito -

On 3/25/13 5:44 PM, Kito Mann wrote:
> Hello everyone,
>
> I was just looking at using pass-through attributes to support
> WAI-ARIA, and I was wondering:
>
> * Shouldn't there be a disabled attribute for <f:passThroughAttribute>
> and <f:passThroughAttributes>?

I think of <f:passThroughAttribute> as being somewhat similar to
<f:attribute>, which has never supported a disabled attribute. I don't
see the need to add this now (for any of the attribute-related tags).

> Also, I know it's too late for this one, but isn't
> <f:passThroughAttribute> awfully verbose? I'm just thinking about how
> much of a pain it will be to use this feature with apps that use JSF
> tags instead of the HTML5-friendly markup. For example, if I want to
> add a few parameters to a component without writing Java code, i'd
> have something like this:
>
> <h:inputText value="#{myBean.value}">
> <f:passThroughAttribute name="aria-required" value="true"/>
> <f:passThroughAttribute name="aria-invalid" value="true"/>
> <f:passThroughAttribute name="..." value="..."/>
> <f:passThroughAttribute name="..." value=".../>
> <f:passThroughAttribute name="..." value="..."/>
> <f:passThroughAttribute name="..." value="..."/>
> </h:inputText>
>
> That's an awful lot of markup for a few extra attributes.


Along with <f:passThroughAttribute>, we also introduced the following
shorthand syntax for specifying pass through attributes:

  <h:inputText value="#{myBean.value}" p:aria-required="true"
p:aria-invalid="true"/>

Where the "p:" alias is mapped to the
"http://xmlns.jcp.org/jsf/passthrough" namespace.

This seems reasonably simple to me.

Alternatively, if you are primarily specifying passthrough attributes,
you can flip things around by taking advantage of passthrough elements, eg:

  <input aria-required="true" aria-invalid="true"
jsf:value="#{myBean.value}"/>

Where the "jsf:" alias is mapped to the "http://xmlns.jcp.org/jsf"
namespace.

Andy

> ___
>
> Kito D. Mann | @kito99 | Author, JSF in Action
> Virtua, Inc. | http://www.virtua.com | JSF/Java EE training and consulting
> http://www.JSFCentral.com - JavaServer Faces FAQ, news, and info |
> @jsfcentral
> +1 203-998-0403
>
> * Listen to the Enterprise Java Newscast:
> _http://blogs.jsfcentral.com/JSFNewscast/
> _
> * JSFCentral Interviews Podcast:
> http://www.jsfcentral.com/resources/jsfcentralpodcasts/
> * Sign up for the JSFCentral
> Newsletter: http://oi.vresp.com/?fid=ac048d0e17