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

[jsr344-experts] Re: [jsr344-experts mirror] Re: [1089-HTML5-data-*attributes] PROPOSAL

From: Edward Burns <edward.burns_at_oracle.com>
Date: Thu, 17 May 2012 13:08:37 -0700

>>>>> On Wed, 16 May 2012 19:48:14 +0200, Frank Caputo <frank_at_frankcaputo.de> said:

FC> This is much easier.
FC> +1

>>>>> On Thu, 17 May 2012 07:48:28 -0700, Edward Burns <edward.burns_at_oracle.com> said:

EB> I have modified the spec and impl to conform to Andy's suggestions.

EB> Here is the commit log, which contains the pertinent excerpts.

EB> - Rework specification and implementation of data-* attributes per EG suggestions.

EB> - Dump JSON in favor of new <f:dataAttribute> element.

[...]

It turns out that original requestor of the feature isn't happy with
dropping the JSON, and here's his email to
users_at_javaserverfaces-spec-public.java.net [1].

On 17 May 2012, Paul Dijou wrote:

PD> +1, it would be easier to read and understand. But I think there is
PD> also problem with this approach :

PD> - it's quite verbose
PD> - there is no possibility to nest data-* attributes
PD> - it's not really dynamic. If you need to have conditionnal data-*
PD> attributes, you would need to have a "rendered" attribute in the
PD> <f:attribute> tag, and test your condition for each tag. A bit
PD> overkill. Easier to build your JSON string in a Java method and pass it
PD> to the "data" attribute.
PD> - how would you explain that there is some attributes in the tag itself
PD> and other that need to use <f:attribute> ? Why not having all of them
PD> either on the tag itself or using <f:attribute> ?

PD> So I'm fine with having the <f:attribute> (or <f:dataAttribute>), it's
PD> easy to use it for simple case. But I would also provide the "data"
PD> attribute supporting JSON for real world applications having complex
PD> data-* attributes cooperating with their Javascript.

PD> About other topics, I agree the "data-*" attributes should always be
PD> generated, even without a HTML5 doctype because it can be use by
PD> Javascript more generally (see the Twitter Bootstrap project).

PD> I also think that EL should be supported inside the JSON. The following
PD> code should be ok :

PD> <h:outputText value="Test" data="{toggle: #{bean.dataToggle}, hide:
PD> #{bean.hide}}" />

PD> I was talking with RichFaces guys about "data-*" attributes. Here is a
PD> summary of our discussion : https://issues.jboss.org/browse/RF-12177

Would anyone object to adding the JSON approach back in? Too
Kitchen-Sink like?

Ed

[1] http://java.net/projects/javaserverfaces-spec-public/lists/users/archive/2012-05/message/17