You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@click.apache.org by Bob Schellink <sa...@gmail.com> on 2010/09/29 12:31:06 UTC

HTML5: data-* atrributes

Interesting new feature in HTML5 is the ability to define your own custom attributes[1] that will be
valid HTML5 markup. In other words these attributes will pass an HTML5 validator.

This is useful for adding metadata to controls that can be manipulated by JS code. For example,
instead of using an element's title attribute to add tooltip information, one can use
data-tooltip="This is a tooltip". Should come in handy.

Bob

[1]: http://html5doctor.com/html5-custom-data-attributes/

HTML parser was[Re: HTML5: data-* atrributes]

Posted by Bob Schellink <sa...@gmail.com>.
I've changed the subject as I don't think this is related to data attributes.

It sounds as what you are after is an HTML parser that is smart enough to add the model data based
on the server-side component ID.

So is the use case to separate the designer from the developer? I think a developer is very
fortunate if there is a dedicated designer for every page of the project. In my experience designers
tend to be involved right in the beginning to design the site after which the developers take over.
So forcing one to develop the markup for every page would mean a lot of duplication of effort,
especially if the develop is alone in maintaining the application. Contrast that with:

$table

which renders all the markup.

You also mention dynamic updating, but that sounded like Ajax?

Btw, if I recall this is the way Wicket[1] works so there might already be an Apache project that
provides what you are after.

Kind regards

Bob

[1]: http://wicket.apache.org/

On 1/10/2010 02:45, florin.g wrote:
> 
> Bob,
> 
> Keep an open mind for a second. 
> 
> How about if we don't use velocity?
> 
> Here's what I'd do, but I don't have the time (sometime I believe the
> brains) to implement such a thing:
> 
> Use the html element ID to identify the mapped java object on the server.
> Process as needed - if text bound to server data (such as a first name of a
> person), the client side would be a  tag; if the element is a structural
> element (table row, selection option) then the server side would do the
> looping. 
> 
> Example 1:
> 
> <p>Dear , we announce a great party this weekend ().</p> 
> 
> The example above will eliminate the use of velocity on the client side:
> #firstName.
> 
> Example 2:
> 
> <table id="invitationsList">
>    <tr id="listItem">
>         <td class="some-class" id="firstName></td>
>         <td id="lastName" class="another-class"></td>
>         <td>Name tag color: </td>
> </tr></table>
> 
> Now, the serverside will know that this a collection and will deal
> accordingly. 
> 
> Why not? To me it is like a dream come true. Whenever I see php or jsp in an
> html page, ah. Would this not eliminate velocity completely? Not only so,
> but you will eliminate the building of any html on the serverside too. Page
> designers will have full control over the page. The use of page fragments
> will facilitate reusable components.
> 
> Do I make any sense?
> 
> 


Re: HTML5: data-* atrributes

Posted by "florin.g" <fl...@bytenotes.com>.
The SPAN tags were deleted above. What I try to say, that a piece of text
that needs to be dynamically updated would be wrapped in a SPAN tag with a
unique ID.
-- 
View this message in context: http://click.1134972.n2.nabble.com/HTML5-data-atrributes-tp5583298p5588482.html
Sent from the click-development mailing list archive at Nabble.com.

Re: HTML5: data-* atrributes

Posted by "florin.g" <fl...@bytenotes.com>.
It so appears but not quite.

The serverside will repeat the html fragment that is provided by the web
designer.

The easiest to illustrate this is with is a list: <ul id="xyz"
class="c1"><li class="c2"></li></ul>. 

The designer provides the html that is the true template for the data. All
that the serverside needs to do is repeat the <li> as formatted. The
following is the logical flow:

HtmlList hList = renderedPage.getElement("myListId");
List<String> items = db.getItems();
foreach (item: items) {
     hList.add(item);
}

So, the serverside does not really build the html but repeats the html
provided. In this case, no component will ever have it's own html embedded
as it is the case in most frameworks.

In the case that there is text needs to be repeated in each <li>, the
designer will provided inside the <li> as such: <li>Item span id="someId"
</li>

The ultimate goal is that the html code is never hidden in java code. 
    

-- 
View this message in context: http://click.1134972.n2.nabble.com/HTML5-data-atrributes-tp5583298p5593298.html
Sent from the click-development mailing list archive at Nabble.com.

Re: HTML5: data-* atrributes

Posted by Beto <gi...@gmail.com>.
This one

<quote>
> <table id="invitationsList">
>   <tr id="listItem">
>        <td class="some-class" id="firstName></td>
>        <td id="lastName" class="another-class"></td>
>        <td>Name tag color: </td>
> </tr></table>
</quote>

or

$table


<quote>
>Not only so, but you will eliminate the building of any html on the serverside too
</quote>

How? In your own example you have to build the html.


Regards,


Gilberto

Re: HTML5: data-* atrributes

Posted by "florin.g" <fl...@bytenotes.com>.
Bob,

Keep an open mind for a second. 

How about if we don't use velocity?

Here's what I'd do, but I don't have the time (sometime I believe the
brains) to implement such a thing:

Use the html element ID to identify the mapped java object on the server.
Process as needed - if text bound to server data (such as a first name of a
person), the client side would be a  tag; if the element is a structural
element (table row, selection option) then the server side would do the
looping. 

Example 1:

<p>Dear , we announce a great party this weekend ().</p> 

The example above will eliminate the use of velocity on the client side:
#firstName.

Example 2:

<table id="invitationsList">
   <tr id="listItem">
        <td class="some-class" id="firstName></td>
        <td id="lastName" class="another-class"></td>
        <td>Name tag color: </td>
</tr></table>

Now, the serverside will know that this a collection and will deal
accordingly. 

Why not? To me it is like a dream come true. Whenever I see php or jsp in an
html page, ah. Would this not eliminate velocity completely? Not only so,
but you will eliminate the building of any html on the serverside too. Page
designers will have full control over the page. The use of page fragments
will facilitate reusable components.

Do I make any sense?


-- 
View this message in context: http://click.1134972.n2.nabble.com/HTML5-data-atrributes-tp5583298p5588462.html
Sent from the click-development mailing list archive at Nabble.com.

Re: HTML5: data-* atrributes

Posted by Bob Schellink <sa...@gmail.com>.
On 30/09/2010 12:20, florin.g wrote:
> 
> So is it time to move away from using any scripting inside an html page? Not
> even velocity?

No not at all. These attributes are defined by the new HTML5 specification, so it could come in
handy however you create the markup:

<div data-tooltip="This is a tooltip">
....
</div>

The above markup will be valid HTML5, even though no attribute called "data-tooltip" exists for the
div element.

HTML5 is still evolving so this feature might not be in the final spec. I just though it is a useful
feature.

Kind regards

Bob

Re: HTML5: data-* atrributes

Posted by "florin.g" <fl...@bytenotes.com>.
So is it time to move away from using any scripting inside an html page? Not
even velocity?
-- 
View this message in context: http://click.1134972.n2.nabble.com/HTML5-data-atrributes-tp5583298p5586382.html
Sent from the click-development mailing list archive at Nabble.com.