You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Juergen Donnerstag <ju...@gmail.com> on 2010/12/30 16:46:35 UTC

automatically open tags for all Components

we have several components which use

	@Override
	protected void onComponentTag(final ComponentTag tag)
	{
		if (tag.isOpenClose())
		{
			tag.setType(TagType.OPEN);
		}
		super.onComponentTag(tag);
	}

to convert the Component's tag open-close to open-body-close. I wonder
whether we should make this the default. It's usually required anyway
and it shouldn't harm any component (incl <input>).

-Juergen

Re: automatically open tags for all Components

Posted by Martin Grigorov <ma...@gmail.com>.
I have problems posting with my @apache.org account. Retrying with @
gmail.com.
See below my opinion.

On Fri, Dec 31, 2010 at 9:26 AM, Martin Grigorov <mg...@apache.org>wrote:

> On Fri, Dec 31, 2010 at 1:57 AM, Jeremy Thomerson <
> jeremy@wickettraining.com> wrote:
>
>> On Thu, Dec 30, 2010 at 5:02 PM, Juergen Donnerstag
>> <ju...@gmail.com> wrote:
>> > right. I didn't mean to apply to 1.4 but 1.5 only
>>
>> Actually, changing my opinion from -0 to -1 (even for 1.5).  We only
>> do this on tags that need it now (Label, for example).  I believe
>> that's the way it should be.
>>
>
> Actually we have this functionality
> already:  org.apache.wicket.markup.parser.filter.OpenCloseTagExpander
> This markup filter transforms the following html elements:
>
> private static final List<String> replaceForTags = Arrays.asList("a", "q",
> "sub", "sup",
> "abbr", "acronym", "cite", "code", "del", "dfn", "em", "ins", "kbd",
> "samp", "var",
>  "label", "textarea", "tr", "td", "th", "caption", "thead", "tbody",
> "tfoot", "dl", "dt",
>  "dd", "li", "ol", "ul", "h1", "h2", "h3", "h4", "h5", "h6", "pre",
> "title", "div"
>
> // tags from pre 1.5 days, shouldnt really be here but make this release
> more backwards
> // compatible
>  , "span", "p", "strong", "b", "e", "select", "col");
>
> I didn't notice when <span/> was added to the list but I had at least three
> "sessions" in IRC when someone complained why <div/> is auto-expanded by
> Wicket and <span/> is not. I remember when Matej added <div/> in the list
> and the reason for that - Firefox did wrong auto-close and broke the user
> application.
>
> I also think it is not Wicket job to fix user's code but the history shows
> that doing this for the elements above didn't hurt anyone so far.
>
> I have one suggestion - instead of using whitelist we can use blacklist for
> the elements we don't want to auto-expand: <meta/>, <input/>, <img/>, <br/>,
> ...
>
>
>>
>> --
>> Jeremy Thomerson
>> http://wickettraining.com
>> Need a CMS for Wicket?  Use Brix! http://brixcms.org
>>
>
>

Re: automatically open tags for all Components

Posted by Martin Grigorov <mg...@apache.org>.
On Fri, Dec 31, 2010 at 1:57 AM, Jeremy Thomerson <jeremy@wickettraining.com
> wrote:

> On Thu, Dec 30, 2010 at 5:02 PM, Juergen Donnerstag
> <ju...@gmail.com> wrote:
> > right. I didn't mean to apply to 1.4 but 1.5 only
>
> Actually, changing my opinion from -0 to -1 (even for 1.5).  We only
> do this on tags that need it now (Label, for example).  I believe
> that's the way it should be.
>

Actually we have this functionality
already:  org.apache.wicket.markup.parser.filter.OpenCloseTagExpander
This markup filter transforms the following html elements:

private static final List<String> replaceForTags = Arrays.asList("a", "q",
"sub", "sup",
"abbr", "acronym", "cite", "code", "del", "dfn", "em", "ins", "kbd", "samp",
"var",
"label", "textarea", "tr", "td", "th", "caption", "thead", "tbody", "tfoot",
"dl", "dt",
"dd", "li", "ol", "ul", "h1", "h2", "h3", "h4", "h5", "h6", "pre", "title",
"div"

// tags from pre 1.5 days, shouldnt really be here but make this release
more backwards
// compatible
, "span", "p", "strong", "b", "e", "select", "col");

I didn't notice when <span/> was added to the list but I had at least three
"sessions" in IRC when someone complained why <div/> is auto-expanded by
Wicket and <span/> is not. I remember when Matej added <div/> in the list
and the reason for that - Firefox did wrong auto-close and broke the user
application.

I also think it is not Wicket job to fix user's code but the history shows
that doing this for the elements above didn't hurt anyone so far.

I have one suggestion - instead of using whitelist we can use blacklist for
the elements we don't want to auto-expand: <meta/>, <input/>, <img/>, <br/>,
...


>
> --
> Jeremy Thomerson
> http://wickettraining.com
> Need a CMS for Wicket?  Use Brix! http://brixcms.org
>

Re: automatically open tags for all Components

Posted by Jeremy Thomerson <je...@wickettraining.com>.
On Thu, Dec 30, 2010 at 5:02 PM, Juergen Donnerstag
<ju...@gmail.com> wrote:
> right. I didn't mean to apply to 1.4 but 1.5 only

Actually, changing my opinion from -0 to -1 (even for 1.5).  We only
do this on tags that need it now (Label, for example).  I believe
that's the way it should be.

-- 
Jeremy Thomerson
http://wickettraining.com
Need a CMS for Wicket?  Use Brix! http://brixcms.org

Re: automatically open tags for all Components

Posted by Juergen Donnerstag <ju...@gmail.com>.
right. I didn't mean to apply to 1.4 but 1.5 only

On Thu, Dec 30, 2010 at 11:54 PM, James Carman
<ja...@carmanconsulting.com> wrote:
> What about other folks' custom components and their markup-based test
> cases?  They would start failing if they failed to do this in their
> code for some reason.
>
> On Thu, Dec 30, 2010 at 5:51 PM, Juergen Donnerstag
> <ju...@gmail.com> wrote:
>> through true, most components already do it anyway. There is almost no
>> effect on our test cases
>>
>>
>> On Thu, Dec 30, 2010 at 11:27 PM, Jeremy Thomerson
>> <je...@wickettraining.com> wrote:
>>> On Thu, Dec 30, 2010 at 9:46 AM, Juergen Donnerstag
>>> <ju...@gmail.com> wrote:
>>>> we have several components which use
>>>>
>>>>        @Override
>>>>        protected void onComponentTag(final ComponentTag tag)
>>>>        {
>>>>                if (tag.isOpenClose())
>>>>                {
>>>>                        tag.setType(TagType.OPEN);
>>>>                }
>>>>                super.onComponentTag(tag);
>>>>        }
>>>>
>>>> to convert the Component's tag open-close to open-body-close. I wonder
>>>> whether we should make this the default. It's usually required anyway
>>>> and it shouldn't harm any component (incl <input>).
>>>>
>>>> -Juergen
>>>>
>>>
>>> -0 - it changes the user's markup for no apparent reason
>>>
>>> --
>>> Jeremy Thomerson
>>> http://wickettraining.com
>>> Need a CMS for Wicket?  Use Brix! http://brixcms.org
>>>
>>
>

Re: automatically open tags for all Components

Posted by James Carman <ja...@carmanconsulting.com>.
What about other folks' custom components and their markup-based test
cases?  They would start failing if they failed to do this in their
code for some reason.

On Thu, Dec 30, 2010 at 5:51 PM, Juergen Donnerstag
<ju...@gmail.com> wrote:
> through true, most components already do it anyway. There is almost no
> effect on our test cases
>
>
> On Thu, Dec 30, 2010 at 11:27 PM, Jeremy Thomerson
> <je...@wickettraining.com> wrote:
>> On Thu, Dec 30, 2010 at 9:46 AM, Juergen Donnerstag
>> <ju...@gmail.com> wrote:
>>> we have several components which use
>>>
>>>        @Override
>>>        protected void onComponentTag(final ComponentTag tag)
>>>        {
>>>                if (tag.isOpenClose())
>>>                {
>>>                        tag.setType(TagType.OPEN);
>>>                }
>>>                super.onComponentTag(tag);
>>>        }
>>>
>>> to convert the Component's tag open-close to open-body-close. I wonder
>>> whether we should make this the default. It's usually required anyway
>>> and it shouldn't harm any component (incl <input>).
>>>
>>> -Juergen
>>>
>>
>> -0 - it changes the user's markup for no apparent reason
>>
>> --
>> Jeremy Thomerson
>> http://wickettraining.com
>> Need a CMS for Wicket?  Use Brix! http://brixcms.org
>>
>

Re: automatically open tags for all Components

Posted by Juergen Donnerstag <ju...@gmail.com>.
through true, most components already do it anyway. There is almost no
effect on our test cases


On Thu, Dec 30, 2010 at 11:27 PM, Jeremy Thomerson
<je...@wickettraining.com> wrote:
> On Thu, Dec 30, 2010 at 9:46 AM, Juergen Donnerstag
> <ju...@gmail.com> wrote:
>> we have several components which use
>>
>>        @Override
>>        protected void onComponentTag(final ComponentTag tag)
>>        {
>>                if (tag.isOpenClose())
>>                {
>>                        tag.setType(TagType.OPEN);
>>                }
>>                super.onComponentTag(tag);
>>        }
>>
>> to convert the Component's tag open-close to open-body-close. I wonder
>> whether we should make this the default. It's usually required anyway
>> and it shouldn't harm any component (incl <input>).
>>
>> -Juergen
>>
>
> -0 - it changes the user's markup for no apparent reason
>
> --
> Jeremy Thomerson
> http://wickettraining.com
> Need a CMS for Wicket?  Use Brix! http://brixcms.org
>

Re: automatically open tags for all Components

Posted by Jeremy Thomerson <je...@wickettraining.com>.
On Thu, Dec 30, 2010 at 9:46 AM, Juergen Donnerstag
<ju...@gmail.com> wrote:
> we have several components which use
>
>        @Override
>        protected void onComponentTag(final ComponentTag tag)
>        {
>                if (tag.isOpenClose())
>                {
>                        tag.setType(TagType.OPEN);
>                }
>                super.onComponentTag(tag);
>        }
>
> to convert the Component's tag open-close to open-body-close. I wonder
> whether we should make this the default. It's usually required anyway
> and it shouldn't harm any component (incl <input>).
>
> -Juergen
>

-0 - it changes the user's markup for no apparent reason

-- 
Jeremy Thomerson
http://wickettraining.com
Need a CMS for Wicket?  Use Brix! http://brixcms.org