Martin Grigorov-4 wrote
> Hi,
> 
> 
> On Thu, Aug 29, 2013 at 3:29 PM, Dirk Forchel <

> dirk.forchel@

> >wrote:
> 
>> I'm currently try to add some kind of microdata
>> (http://en.wikipedia.org/wiki/Microdata_%28HTML%29) to our project.
>> Exists a
>> wicketstuff project dealing with this problem?
>>
> 
> I'm not aware of such.
> 
> 
>> What is the preferred way to add "valueless" attributes to HTML tags?
>> E.g.
>> I
>> have to add the following attributes to the body tag:
>>
>> 
> <body id="foo" itemscope itemtype="http://scheme.org/WebPage";>
>>
>> 
> </body>
>>
>> At the base page class I've added a TransparentMarkupContainer the
>> following
>> way:
>>
>> this.body = new TransparentWebMarkupContainer("body");
>> this.body.setOutputMarkupId(true);
>>
>> HTML:
>>
>> 
> <body wicket:id="body">
>>    
> <wicket:child/>
>> 
> </body>
>>
>> At a subclass I did:
>>
>> getBody().setMarkupId("foo").add( AttributeModifier.append("itemscope",
>> AttributeModifier.VALUELESS_ATTRIBUTE_ADD ) ).add(
>> AttributeModifier.append(
>> "itemtype", Model.of( "http://scheme.org/WebPage"; ) ) );
>>
>> Is this the preferred way to add "valueless" attributes to a tag (I've
>> never
>>
> 
> Yes. This is the way to tell Wicket to not add a value for the attribute.

Okay. I've never seen this before. That's why I was asking.


Martin Grigorov-4 wrote
> Another way is to add these attributes directly in the markup. No need to
> add Behavior to the components for something that is always true.

Yes, but I prefer the "dynamic" way. A Component/Page provides some kind of
"microdata" and implements an interface. The AttributeAppender takes the
information and writes the appropriate attribute at the tag.


Martin Grigorov-4 wrote
>> seen this before)? Or is this marker value for internal use only? At
>> least
>> the generated HTML code looks like intended.
>> I would like to know whether there is a kind of general solution to deal
>> with "microdata", say a bunch of Behavior-classes to add this kind of
>> data.
>>
> 
> AttributeModifier is a Behavior itself.
> There is no special code in Wicket for microdata. This specification is
> not
> broadly used.

I thought someone has had the same requirements within his project and came
with a general solution for this specification. Okay, fair enough. 




--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-and-microdata-tp4661135p4661153.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to