You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Korbinian Bachl <ko...@whiskyworld.de> on 2007/05/27 22:10:34 UTC

wicket 1.3.0 snapshot / wicket tags in div

Hi,
 
i've come across a behaviour, that IMHO is wrong:
 
when i have a wicket label e.g:
 
HTML:
 
<div wicket:id="foo"> bla bla </div>
 
adn use it as new Label("foo", "bar") in dev, he puts out:
 
result: <div wicket:id="foo">bar</div>
 
wich is right; however if i do: 
getMarkupSettings().setStripWicketTags(true);
 
in the init he puts out:
 
result: <div>bar</div>
 
which is blowing up HTML-output for nothing - IMHO if the tags are empty
after the wicket:id has been stripped they should be removed completely.
 
Is this behavoir intention or a bug?
 
 

AW: wicket 1.3.0 snapshot / wicket tags in div

Posted by Korbinian Bachl <ko...@whiskyworld.de>.
Hi Martinj,

i only want to do it for empty <div>'s - not any other tag. So how can I
strip out any empty <div>-tag without hurting used ones? 

> If you *really* want to do this, why not create a visitor 
> that calls setRenderBodyOnly on your child components?

how would I do this?

Regards


> -----Ursprüngliche Nachricht-----
> Von: Martijn Dashorst [mailto:martijn.dashorst@gmail.com] 
> Gesendet: Sonntag, 27. Mai 2007 22:46
> An: wicket-dev@incubator.apache.org
> Betreff: Re: wicket 1.3.0 snapshot / wicket tags in div
> 
> On 5/27/07, Korbinian Bachl <ko...@whiskyworld.de> wrote:
> >
> > hmm, makes sense - there is no global way to get rid of 
> these empty div's ?
> > (putting a .setRenderBodyOnly(true) to every seems quite a pain)
> 
> I really don't know why you want to do this:
> 
> <td wicket:id="foo">[foo]</td>
> 
> <tr wicket:id="foo"><td wicket:id="bar"></td></tr>
> 
> new ListView("foo", ...) {
>     protected void populateItem(Item item) {
>         item.add(new Label("bar", "bar"));
>     }
> }
> 
> should this remove the tags too?
> 
> If you *really* want to do this, why not create a visitor 
> that calls setRenderBodyOnly on your child components?
> 
> Martijn
> 
> --
> Join the wicket community at irc.freenode.net: ##wicket 
> Wicket 1.2.6 contains a very important fix. Download Wicket now!
> http://wicketframework.org
> 


Re: wicket 1.3.0 snapshot / wicket tags in div

Posted by Martijn Dashorst <ma...@gmail.com>.
On 5/27/07, Korbinian Bachl <ko...@whiskyworld.de> wrote:
>
> hmm, makes sense - there is no global way to get rid of these empty div's ?
> (putting a .setRenderBodyOnly(true) to every seems quite a pain)

I really don't know why you want to do this:

<td wicket:id="foo">[foo]</td>

<tr wicket:id="foo"><td wicket:id="bar"></td></tr>

new ListView("foo", ...) {
    protected void populateItem(Item item) {
        item.add(new Label("bar", "bar"));
    }
}

should this remove the tags too?

If you *really* want to do this, why not create a visitor that calls
setRenderBodyOnly on your child components?

Martijn

-- 
Join the wicket community at irc.freenode.net: ##wicket
Wicket 1.2.6 contains a very important fix. Download Wicket now!
http://wicketframework.org

AW: AW: AW: wicket 1.3.0 snapshot / wicket tags in div

Posted by Korbinian Bachl <ko...@whiskyworld.de>.
Hi,

well, i prefer plain, straight html without any tables (only tables if they
are really necessary which is quite rare) and the only thing an empty <div>
does is to put a blank line before and after it (see W3C definition) wich is
sth. IMHO the <p> tag is sufficent for.

2; well - I don't - and the thing here from the origin post was based on a
mistake by me... in fact, the empty div's came from an RepeatingView
container who just ignores the .setRenderBodyOnly(true) ... (see my post in
wicket user list for details). I now understand why wicket cant strip the
tags by default, but need to find a solution for the RepeatingView (i use it
in a BasePage or for dynamic forms - but get loads of empty divs because of
that)

Regards



> -----Ursprüngliche Nachricht-----
> Von: Herman Bovens [mailto:herman.bovens@chello.be] 
> Gesendet: Montag, 28. Mai 2007 15:02
> An: wicket-dev@incubator.apache.org
> Betreff: Re: AW: AW: wicket 1.3.0 snapshot / wicket tags in div
> 
> 
> 1) OK, but doesn't it render differently then?
> 2) Do you use DIV e.g. inside TD tags?  I think you 
> shouldn't: just add the wicket:id to the TD tag.  But then of 
> course you don't want the TD tag to disappear, so you use an 
> ordinary Label instead of the subclass.
> 
> 
> Korbinian Bachl wrote:
> > 
> > 
> > 1; the label was just an example - the reason I choose 
> <div> is that 
> > is invalid for certain surroundings while <div> is always valid
> > 
> > 2; no - in all cases where <div> is solo and empty it is 
> very bad html 
> > output IMHO to have empty <div>'s - they allways should 
> have at least 
> > any kind of descriptor/ tag in them
> > 
> >> -----Ursprüngliche Nachricht-----
> >> Von: Herman Bovens [mailto:herman.bovens@chello.be]
> >> Gesendet: Montag, 28. Mai 2007 01:19
> >> An: wicket-dev@incubator.apache.org
> >> Betreff: Re: AW: wicket 1.3.0 snapshot / wicket tags in div
> >> 
> >> 
> >> 1) I think you should only use a &lt;div&gt; tag if you 
> want one.  I 
> >> usually use &lt;span&gt; for labels.
> >> 2) If removing the tag is what you want, I assume that's only for 
> >> labels and only in some cases.  Why not create a subclass of Label 
> >> which calls
> >> setRenderBodyOnly(true) in the constructor?
> >> 
> >> 
> >> Korbinian Bachl wrote:
> >> > 
> >> > hmm, makes sense - there is no global way to get rid of 
> these empty 
> >> > div's ?
> >> > (putting a .setRenderBodyOnly(true) to every seems quite a pain)
> >> > 
> >> 
> >> --
> >> View this message in context: 
> >> http://www.nabble.com/wicket-1.3.0-snapshot---wicket-tags-in-d
> > iv-tf3824821.html#a10829469
> >> Sent from the Wicket - Dev mailing list archive at Nabble.com.
> >> 
> >> 
> > 
> > 
> > 
> 
> --
> View this message in context: 
> http://www.nabble.com/wicket-1.3.0-snapshot---wicket-tags-in-d
iv-tf3824821.html#a10835894
> Sent from the Wicket - Dev mailing list archive at Nabble.com.
> 
> 


Re: AW: AW: wicket 1.3.0 snapshot / wicket tags in div

Posted by Herman Bovens <he...@chello.be>.
1) OK, but doesn't it render differently then?
2) Do you use DIV e.g. inside TD tags?  I think you shouldn't: just add the
wicket:id to the TD tag.  But then of course you don't want the TD tag to
disappear, so you use an ordinary Label instead of the subclass.


Korbinian Bachl wrote:
> 
> 
> 1; the label was just an example - the reason I choose <div> is that 
> is invalid for certain surroundings while <div> is always valid
> 
> 2; no - in all cases where <div> is solo and empty it is very bad html
> output IMHO to have empty <div>'s - they allways should have at least any
> kind of descriptor/ tag in them  
> 
>> -----Ursprüngliche Nachricht-----
>> Von: Herman Bovens [mailto:herman.bovens@chello.be] 
>> Gesendet: Montag, 28. Mai 2007 01:19
>> An: wicket-dev@incubator.apache.org
>> Betreff: Re: AW: wicket 1.3.0 snapshot / wicket tags in div
>> 
>> 
>> 1) I think you should only use a &lt;div&gt; tag if you want 
>> one.  I usually use &lt;span&gt; for labels.
>> 2) If removing the tag is what you want, I assume that's only 
>> for labels and only in some cases.  Why not create a subclass 
>> of Label which calls
>> setRenderBodyOnly(true) in the constructor?
>> 
>> 
>> Korbinian Bachl wrote:
>> > 
>> > hmm, makes sense - there is no global way to get rid of these empty 
>> > div's ?
>> > (putting a .setRenderBodyOnly(true) to every seems quite a pain)
>> > 
>> 
>> --
>> View this message in context: 
>> http://www.nabble.com/wicket-1.3.0-snapshot---wicket-tags-in-d
> iv-tf3824821.html#a10829469
>> Sent from the Wicket - Dev mailing list archive at Nabble.com.
>> 
>> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/wicket-1.3.0-snapshot---wicket-tags-in-div-tf3824821.html#a10835894
Sent from the Wicket - Dev mailing list archive at Nabble.com.


AW: AW: wicket 1.3.0 snapshot / wicket tags in div

Posted by Korbinian Bachl <ko...@whiskyworld.de>.
1; the label was just an example - the reason I choose <div> is that <span>
is invalid for certain surroundings while <div> is always valid

2; no - in all cases where <div> is solo and empty it is very bad html
output IMHO to have empty <div>'s - they allways should have at least any
kind of descriptor/ tag in them  

> -----Ursprüngliche Nachricht-----
> Von: Herman Bovens [mailto:herman.bovens@chello.be] 
> Gesendet: Montag, 28. Mai 2007 01:19
> An: wicket-dev@incubator.apache.org
> Betreff: Re: AW: wicket 1.3.0 snapshot / wicket tags in div
> 
> 
> 1) I think you should only use a &lt;div&gt; tag if you want 
> one.  I usually use &lt;span&gt; for labels.
> 2) If removing the tag is what you want, I assume that's only 
> for labels and only in some cases.  Why not create a subclass 
> of Label which calls
> setRenderBodyOnly(true) in the constructor?
> 
> 
> Korbinian Bachl wrote:
> > 
> > hmm, makes sense - there is no global way to get rid of these empty 
> > div's ?
> > (putting a .setRenderBodyOnly(true) to every seems quite a pain)
> > 
> 
> --
> View this message in context: 
> http://www.nabble.com/wicket-1.3.0-snapshot---wicket-tags-in-d
iv-tf3824821.html#a10829469
> Sent from the Wicket - Dev mailing list archive at Nabble.com.
> 
> 


Re: AW: wicket 1.3.0 snapshot / wicket tags in div

Posted by Herman Bovens <he...@chello.be>.
1) I think you should only use a &lt;div&gt; tag if you want one.  I usually
use &lt;span&gt; for labels.
2) If removing the tag is what you want, I assume that's only for labels and
only in some cases.  Why not create a subclass of Label which calls
setRenderBodyOnly(true) in the constructor?


Korbinian Bachl wrote:
> 
> hmm, makes sense - there is no global way to get rid of these empty div's
> ?
> (putting a .setRenderBodyOnly(true) to every seems quite a pain)
> 

-- 
View this message in context: http://www.nabble.com/wicket-1.3.0-snapshot---wicket-tags-in-div-tf3824821.html#a10829469
Sent from the Wicket - Dev mailing list archive at Nabble.com.


AW: wicket 1.3.0 snapshot / wicket tags in div

Posted by Korbinian Bachl <ko...@whiskyworld.de>.
hmm, makes sense - there is no global way to get rid of these empty div's ?
(putting a .setRenderBodyOnly(true) to every seems quite a pain)


 

> -----Ursprüngliche Nachricht-----
> Von: Martijn Dashorst [mailto:martijn.dashorst@gmail.com] 
> Gesendet: Sonntag, 27. Mai 2007 22:13
> An: wicket-dev@incubator.apache.org
> Betreff: Re: wicket 1.3.0 snapshot / wicket tags in div
> 
> Intention. Read the javadocs.
> 
> What you are proposing is changing the meaning of the 
> document without any idea: what would happen if:
> <h1 wicket:id="foo">[foo]</h1>
> 
> is used? Would setStripWicketTags remove the <h1> too?
> 
> Component#setRenderBodyOnly(boolean) is what you are looking for.
> 
> Martijn
> 
> On 5/27/07, Korbinian Bachl <ko...@whiskyworld.de> wrote:
> > Hi,
> >
> > i've come across a behaviour, that IMHO is wrong:
> >
> > when i have a wicket label e.g:
> >
> > HTML:
> >
> > <div wicket:id="foo"> bla bla </div>
> >
> > adn use it as new Label("foo", "bar") in dev, he puts out:
> >
> > result: <div wicket:id="foo">bar</div>
> >
> > wich is right; however if i do:
> > getMarkupSettings().setStripWicketTags(true);
> >
> > in the init he puts out:
> >
> > result: <div>bar</div>
> >
> > which is blowing up HTML-output for nothing - IMHO if the tags are 
> > empty after the wicket:id has been stripped they should be 
> removed completely.
> >
> > Is this behavoir intention or a bug?
> >
> >
> >
> 
> 
> --
> Join the wicket community at irc.freenode.net: ##wicket 
> Wicket 1.2.6 contains a very important fix. Download Wicket now!
> http://wicketframework.org
> 


Re: wicket 1.3.0 snapshot / wicket tags in div

Posted by Martijn Dashorst <ma...@gmail.com>.
Intention. Read the javadocs.

What you are proposing is changing the meaning of the document without
any idea: what would happen if:
<h1 wicket:id="foo">[foo]</h1>

is used? Would setStripWicketTags remove the <h1> too?

Component#setRenderBodyOnly(boolean) is what you are looking for.

Martijn

On 5/27/07, Korbinian Bachl <ko...@whiskyworld.de> wrote:
> Hi,
>
> i've come across a behaviour, that IMHO is wrong:
>
> when i have a wicket label e.g:
>
> HTML:
>
> <div wicket:id="foo"> bla bla </div>
>
> adn use it as new Label("foo", "bar") in dev, he puts out:
>
> result: <div wicket:id="foo">bar</div>
>
> wich is right; however if i do:
> getMarkupSettings().setStripWicketTags(true);
>
> in the init he puts out:
>
> result: <div>bar</div>
>
> which is blowing up HTML-output for nothing - IMHO if the tags are empty
> after the wicket:id has been stripped they should be removed completely.
>
> Is this behavoir intention or a bug?
>
>
>


-- 
Join the wicket community at irc.freenode.net: ##wicket
Wicket 1.2.6 contains a very important fix. Download Wicket now!
http://wicketframework.org