You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Martin Grigorov <mg...@apache.org> on 2011/09/12 17:32:03 UTC

Usecases for Ajax update of invisible component w/o placeholder

Hi,

Recently I had to investigate a problem where a component associated
with <tfoot> didn't disappear after : comp.setVisible(false) +
target.add(comp).
The problem was that comp.setOutputMarkupPlaceholderTag(true) was
missing and the Ajax response for this component looked like:
<component id="component2" ><![CDATA[]]></component>

Looking at wicket-ajax.js' replaceOuterHtmlXyz() methods I can see
just unspecified behavior for the case when the new component's text
representation is "".

For IE and Safari we do:
       oldElement.outerHTML = text;

For Gecko:
	var fragment = range.createContextualFragment(text);		
        element.parentNode.replaceChild(fragment, element);

So it seems like the old component should be replaced with new text
node without value, but it seems there are browser inconsistencies
like TFOOT in IE7 which just prevent the replacement.

My question is: are there any use cases which rely on the old
component to be replaced by empty text node instead of <oldName
style="display:none"></oldName> ?

Just ignore the fact that any following comp.setVisible(true) +
target.add(comp) wont work. We already know that.

I'm thinking to add a warning log for such cases (invisible w/o
placeholder tag added to the target) but maybe someone relies on this
behavior.

-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

Re: Usecases for Ajax update of invisible component w/o placeholder

Posted by Martin Grigorov <mg...@apache.org>.
I don't like it for some reason.
This way the server tree will know about invisible component, while
the client (DOM) tree will have no component at all.

I think "display: none" should be used.

On Mon, Sep 12, 2011 at 6:57 PM, Igor Vaynberg <ig...@gmail.com> wrote:
> why not just remove the node using removeChild(x)?
>
> -igor
>
> On Mon, Sep 12, 2011 at 8:32 AM, Martin Grigorov <mg...@apache.org> wrote:
>> Hi,
>>
>> Recently I had to investigate a problem where a component associated
>> with <tfoot> didn't disappear after : comp.setVisible(false) +
>> target.add(comp).
>> The problem was that comp.setOutputMarkupPlaceholderTag(true) was
>> missing and the Ajax response for this component looked like:
>> <component id="component2" ><![CDATA[]]></component>
>>
>> Looking at wicket-ajax.js' replaceOuterHtmlXyz() methods I can see
>> just unspecified behavior for the case when the new component's text
>> representation is "".
>>
>> For IE and Safari we do:
>>       oldElement.outerHTML = text;
>>
>> For Gecko:
>>        var fragment = range.createContextualFragment(text);
>>        element.parentNode.replaceChild(fragment, element);
>>
>> So it seems like the old component should be replaced with new text
>> node without value, but it seems there are browser inconsistencies
>> like TFOOT in IE7 which just prevent the replacement.
>>
>> My question is: are there any use cases which rely on the old
>> component to be replaced by empty text node instead of <oldName
>> style="display:none"></oldName> ?
>>
>> Just ignore the fact that any following comp.setVisible(true) +
>> target.add(comp) wont work. We already know that.
>>
>> I'm thinking to add a warning log for such cases (invisible w/o
>> placeholder tag added to the target) but maybe someone relies on this
>> behavior.
>>
>> --
>> Martin Grigorov
>> jWeekend
>> Training, Consulting, Development
>> http://jWeekend.com
>>
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

Re: Usecases for Ajax update of invisible component w/o placeholder

Posted by Igor Vaynberg <ig...@gmail.com>.
why not just remove the node using removeChild(x)?

-igor

On Mon, Sep 12, 2011 at 8:32 AM, Martin Grigorov <mg...@apache.org> wrote:
> Hi,
>
> Recently I had to investigate a problem where a component associated
> with <tfoot> didn't disappear after : comp.setVisible(false) +
> target.add(comp).
> The problem was that comp.setOutputMarkupPlaceholderTag(true) was
> missing and the Ajax response for this component looked like:
> <component id="component2" ><![CDATA[]]></component>
>
> Looking at wicket-ajax.js' replaceOuterHtmlXyz() methods I can see
> just unspecified behavior for the case when the new component's text
> representation is "".
>
> For IE and Safari we do:
>       oldElement.outerHTML = text;
>
> For Gecko:
>        var fragment = range.createContextualFragment(text);
>        element.parentNode.replaceChild(fragment, element);
>
> So it seems like the old component should be replaced with new text
> node without value, but it seems there are browser inconsistencies
> like TFOOT in IE7 which just prevent the replacement.
>
> My question is: are there any use cases which rely on the old
> component to be replaced by empty text node instead of <oldName
> style="display:none"></oldName> ?
>
> Just ignore the fact that any following comp.setVisible(true) +
> target.add(comp) wont work. We already know that.
>
> I'm thinking to add a warning log for such cases (invisible w/o
> placeholder tag added to the target) but maybe someone relies on this
> behavior.
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
>