Menu

#30 Fix for IE6 and hidden panels

open
nobody
None
5
2007-12-10
2007-12-10
Anonymous
No

I had trouble with IE6 (and below) applying line-height to an anthem:Panel with Visible="false".

Anthem renders this for a hidden panel:
<div id="controlId"></div>

http://lists.evolt.org/archive/Week-of-Mon-20070416/189398.html suggests that the following stops the problem:
<div id="controlId"><!-- --></div>

To implement, add the following at line 52 of Panel.cs:
else
{
// This is so that IE6 doesn't apply line height to an empty div
writer.Write("<!-- -->");
}

Cheers,
Gavin.

Discussion

  • Nobody/Anonymous

    Logged In: NO

    Correction. Code should be:
    else if (!Manager.IsCallBack)
    {
    // This is so that IE6 doesn't apply line height to an empty div
    writer.Write("<!-- -->");
    }

    Gavin.

     
  • Andy Miller

    Andy Miller - 2007-12-10

    Logged In: YES
    user_id=1245761
    Originator: NO

    Great tip! I suppose this applies to all of the Anthem controls that wrap the native control inside of a <div>.

    Since the type of element that is used does not matter to Anthem, perhaps we should always use an inline control when the native control is not visible (i.e. use <span></span> when Visible=false, and <div></div> otherwise).

    Or we could assign a class to the wrapper element such as

    <div class="anthem"> wrapped HTML </div>
    <div class="anthem hidden"></div>

    Then you could modify your stylesheet to do anything you want with Anthem controls.

     
  • TweeZz

    TweeZz - 2007-12-10

    Logged In: YES
    user_id=1472130
    Originator: NO

    Hi Andy, I think the second solution you suggested is somehow 'safer'. At least for the applications I wrote using Anthem. I'm a heavy prototype user. In some cases I retrieve elements using css selectors. Sometimes a part of the selector includes the wrapper 'div'. Changing it into a 'span' would break code, maybe not only in my applications.
    Maybe I'm being to selfish here :)

     
  • Pieter Siegers

    Pieter Siegers - 2007-12-31

    Logged In: YES
    user_id=1067768
    Originator: NO

    Hi all, I agree with Manu, and think that adding a css class id is a good idea.

     
  • Pieter Siegers

    Pieter Siegers - 2008-01-17

    Logged In: YES
    user_id=1067768
    Originator: NO

    Hi Gavin, did you test this code only in IE6 or also in other browsers?
    PD: I'm talking about the following code (added to Panel.cs starting from line 52):

    else if (!Manager.IsCallBack)
    {
    // This is so that IE6 doesn't apply line height to an empty div
    writer.Write("<!-- -->");
    }

     
  • Nobody/Anonymous

    Logged In: NO

    Hi psiegers.

    The code has fixed the rendering bug in the following browsers:
    - Internet Explorer 6
    - Internet Explorer 5.5

    The code has been used in the following browsers with no ill effects:
    - Firefox 2.0
    - Opera 9
    - Internet Explorer 7
    - Safari 3

    All browsers are running on Windows XP SP 2

    Cheers,
    Gavin.

     
  • Andy Miller

    Andy Miller - 2008-01-29

    Logged In: YES
    user_id=1245761
    Originator: NO

    Are you recommending this for all Anthem controls that render a <div> wrapper?

     
  • Nobody/Anonymous

    Logged In: NO

    afm_44,

    I'd recommend that, yes. It sounds like you and psiegers have grander plans for the markup of hidden controls, but adding that empty comment fixed all my rendering problems.

    Cheers,
    Gavin.

     
  • Nobody/Anonymous

    Logged In: NO

    If a I have a non Anthem control inside odes not render it

     
  • Nobody/Anonymous

    Logged In: NO

    If a I have a non Anthem control inside does not render it

     

Log in to post a comment.