View all of Fi's updates Kontained: 2 months ago

Browsers Gone Wild

Ever run into a really annoying, impossible browser bug which it seems that no one on the web has ever heard of? Without even going into IE6 or hasLayout issues, here are some doozies we've run across during our projects, and the solutions we found:

IE7 applies CSS rules to HTML comments
It is actually well-documented that IE treats comment nodes as children in some situations. However, this can still create some difficult-to-diagnose "disappearing" :first-child and adjacent sibling CSS rules. Check out these useful links:
http://archivist.incutio.com/viewlist/css-discuss/73965
http://robertnyman.com/2009/02/04/how-to-solve-first-child-css-bug-in-ie-7/

jQuery’s mouseleave event in IE7
Recently I was having trouble with the mouseleave event handler for a simple rollover menu, where the event was being dispatched while the mouse was apparently still inside the element.
The basic structure of the menu was
    <div id="myDiv">
      <ul>
         <li>Option</li>
         <li>Option</li>
         <li>Option</li>
      </ul>
    </div>

While mousing over the lower list elements, the mouseleave event would be dispatched on myDiv. At first I suspected the typical box size or hasLayout issues, but when none of the standard fixes for that worked, I accidentally found a solution: While testing the rendered dimensions of the box by setting a background image on myDiv, I discovered that the mouseleave event was triggered at the expected positions. The final solution was to apply a repeated transparent background image to myDiv for IE.

IE6 not respecting short div heights
Okay, I said I wouldn’t go into IE6, but this one deserves a mention. We’ve run into this on various occasions when using empty div’s with a background image to add top and bottom rounded corners to a module, like in this example:
    <div>
        <div></div>
        <div><!-- content goes here --></div>
        <div></div>
    </div>

Sometimes in IE6 one of the background-only div’s wouldn’t respect the pixel height set in CSS, causing gaps (show in this image by the red background).

 

 

The issue seems to be related to positioning context with font size and line-height factored in. We’ve found various fixes:
1. Set font size to 1px  or 0
2. Set overflow:hidden on the div
3. Place an empty HTML comment in the div. This one wins for convolutedness.

The Microsoft alpha opacity filter causes the page to render sluggishly
We’ve found that applying the opacity filter to any single element on the page negatively impacted the overall performance of page rendering, scrolling, and image-sprite rollovers. It is faster to use transparent PNGs where possible.

Firefox 2 bug with display: -moz-inline-stack
When using this to replace display: inline-block for Firefox 2, I found that inline child nodes were collapsing on top of child text nodes like so:
    <ul>
        <li style="display:-moz-inline-stack;border-right:1px solid gray;">Name: <a href="#">John Doe</a></li>
        <li style="display:-moz-inline-stack">Some text</li>
    </ul>
Displayed as

 

 After much trial and error, wrapping the text nodes in a <span> fixed the issue:

    <ul>
        <li style="display:-moz-inline-stack;border-right:1px solid gray;">

            <span>Name: <a href="#">John Doe</a><span /></span>

        </li>
        <li style="display:-moz-inline-stack">Some text</li>
    </ul>
Which displays as expected:

 

One tab’s contents in IE 8 RC were affected by the contents in another tab
We’ll give ‘em a freebie since it wasn’t the final release, but this has got to be the most amazing bug I have ever seen. This truly happened although the details were lost in the annals of weirdness...

 

@author Heidi Hunter is wearing her Senior Application Developer hat for this post. We are always looking for talented web developers to challenge her to who can find (and solve!) the craziest browser behavior.

Share this entry

Close
Invalid e-mail format, please try again

Your friends will be notified via email about this entry.

Remove Email

You are about to remove the selected emails from your list. Are you sure you want to remove them?

Yes
Cancel
Select All Deselect All Remove Selected

Share with third party communities This will take you to a new window.


Report Inappropriate Content

Close
Details
Operations

Thank You!

The safety and legitimacy of Kontain's content is paramount to us. We will be investigating this content shortly. Here is what you reported:

Report Category Harmful of Dangerous Acts Report Detail Drug Abuse
Additional Information

Lorem ipsum dolor sit amet consectetuer adipiscing elit penubrum purous

Comments (7)

  • tomantonis 2 months ago

    It is faster to use transparent PNGs where possible.

     

    Yes. Except if you want to use the alpha-channel and IE-compatibility. Even the latest IE8 can't render <100% transparant PNG's well. It renders the image inline's transparancy good, but not if you want to play with the alpha-channel from the whole image (ie. <div><img src="image.png"></div> and then use jQuery's fadeOut() function: $('<div>').fadeOut()...). It's a shame, Microsoft!

    And yes, there's a workaround for that, but I'd like to avoid that.

  • BjornSchul... 2 months ago

    This is why I am still a Flash developer

  • skittle 2 months ago

    Love this post! I'm especially happy your wrote about the jquery problem.. I ran into that problem a few days ago and put it aside since I couldn't figure it out, thanks! You spoke about alpha opacity filter running slowly, has FI looked into making the Kontain site run faster on mobile devices? I'm aware of the upcoming iPhone app, however, with more and more phones being able to access the web, are there plans to skin the site for a smaller scale? Running the Kontain site just about kills my iPhone, causing it to freeze until all the content is downloaded and settled. I'm curious to see how other mobile devices can take on such a taxing website as Kontain.

  • Matt 2 months ago

    ever see the one with flex developed swf and flash swf (not sure if the IDE matters but it's what we saw).  For mac firefox 2 mouse in and out of the flex app, flash app fades to black

  • heidi 2 months ago

    @tomantonis: You're right. Like I said, transparent PNGs can only replace Alpha filter in some situations. Actually, we usually avoid tweening opacity in IE at all due to the slow and unpleasant performance.

     

    @skittle: Mobile is definitely on our radar, but no promises on timing yet :)

     

    @Bjorn & @Matt: The crazy stuff we've seen and done in Flash would be a whole other topic!

  • ugg boots 1 month ago

    I recently came accross your blog and have been reading along. I thought I would leave my first comment. I dont know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often.

  • Jiri Rybar 1 month ago

    I've had theproblem with short height div's exactly as you mentioned. Thanks for resolving it.

What do you think?

Collapse

More from Fi

  1. How to destroy Canon 5D's - Just go snowmobiling with us!

    How to destroy Canon 5D'...

    03/08/10 6933 views
  2. Thanks for attending our SEO Event in New York City

    Thanks for attending our...

    03/06/10 7742 views
  3. Technology choices on the rise. Silverlight projects on the up at Fi

    Technology choices on th...

    03/04/10 16650 views
  4. Fi Veteran

    Fi Veteran

    03/03/10 24278 views
  5. Bowling Extravaganza

    Bowling Extravaganza

    02/26/10 20203 views
  6. Fi Is HIRING

    Fi Is HIRING

    02/19/10 39819 views

Subscribe to Fi

Feeds are an easy way to stay up-to-date with websites you love. Feeds automatically update and show you the newest content without you having to check. Read more here.

All you need is a Feed Reader, like these free ones for Mac and PC.

Close
Collapse

Featured Kontainers

Copyright © 2010 Kontain LLC. All rights reserved