You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Simon B <si...@gmail.com> on 2013/06/03 12:28:20 UTC

AttributeModifier with html in the attribute?

Hello 

I want to add html content in an attribute of an html tag.  

This is for a bootstrap tooltip. 

What is the best way to do this?  When I simply add html to the attribute
modifier e.g.


it gets converted into 



What I'd like is: 



What's the best way to achieve this?

Simon



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/AttributeModifier-with-html-in-the-attribute-tp4659206.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: AttributeModifier with html in the attribute?

Posted by Simon B <si...@gmail.com>.
Hello Bertrand, 

Thank you for your answer I'll try "option 3" and create a component
subclass.

Cheers
Simon



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/AttributeModifier-with-html-in-the-attribute-tp4659206p4659226.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: AttributeModifier with html in the attribute?

Posted by Bertrand Guay-Paquet <be...@step.polymtl.ca>.
I believe AttributeModifier is the appropriate class to use to modify 
tag attributes. Moreover, it is described in the section you refer to.

For reference, ComponentTag#writeOutput() is the method which calls 
Strings.escapeMarkup(value); and escapes your tag value. This is called 
by Component#renderComponentTag().

Unfortunately, there doesn't seem to currently be a way to not escape 
the markup of the tag values. It is possible for labels but not for the 
tag attributes. I can think of 3 options:

1) [unsafe] remove the tag escaping at large
2) modify Wicket to add a flag somewhere to disable tag escaping
3) create your Component subclass which overrides getMarkup() to weave 
in your raw html

Either way, I think this should be added to Wicket because html data- 
attributes seem to gain popularity.

Regards,
Bertrand

On 03/06/2013 10:22 AM, Paul Bors wrote:
> AttributeModifier?
>
> You might be interested in taking a quick look at (Section 4.2 "Modifying
> Tag Attributes"):
> http://wicket.apache.org/learn/books/freeguide.html
>
> ~ Thank you,
>    Paul Bors
>
> -----Original Message-----
> From: Simon B [mailto:simon.botting@gmail.com]
> Sent: Monday, June 03, 2013 6:28 AM
> To: users@wicket.apache.org
> Subject: AttributeModifier with html in the attribute?
>
> Hello
>
> I want to add html content in an attribute of an html tag.
>
> This is for a bootstrap tooltip.
>
> What is the best way to do this?  When I simply add html to the attribute
> modifier e.g.
>
>
> it gets converted into
>
>
>
> What I'd like is:
>
>
>
> What's the best way to achieve this?
>
> Simon
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/AttributeModifier-with-html-in-th
> e-attribute-tp4659206.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


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


RE: AttributeModifier with html in the attribute?

Posted by Paul Bors <pa...@bors.ws>.
AttributeModifier?

You might be interested in taking a quick look at (Section 4.2 "Modifying
Tag Attributes"):
http://wicket.apache.org/learn/books/freeguide.html

~ Thank you,
  Paul Bors

-----Original Message-----
From: Simon B [mailto:simon.botting@gmail.com] 
Sent: Monday, June 03, 2013 6:28 AM
To: users@wicket.apache.org
Subject: AttributeModifier with html in the attribute?

Hello 

I want to add html content in an attribute of an html tag.  

This is for a bootstrap tooltip. 

What is the best way to do this?  When I simply add html to the attribute
modifier e.g.


it gets converted into 



What I'd like is: 



What's the best way to achieve this?

Simon



--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/AttributeModifier-with-html-in-th
e-attribute-tp4659206.html
Sent from the Users forum mailing list archive at Nabble.com.

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



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