More IE Oddities

I’ve started a rewrite of the rMenu system based on what I’ve learned about IE and hasLayout in the last couple weeks.

One problem I encountered was with borders. I like to wrap a border around each menu item to distinguish each one and provide some visual border to the menu. Typically I’d wrap an anchor or parent LI in a border and then apply a negative 1px margin on the bottom of each anchor or LI for vertical and right for horizontal menus. This keeps borders from doubling-up when two items are next to each other. The problem was that IE6 (and earlier) would drop the border on the extreme edge (the bottom-most or left-most item) of the menu. So then I’d try applying borders without the use of negative margins, such as applying the UL with a border on 3 of the 4 sides, and apply all LI or A elements with a border on that 4th side. This works well for vertical menus but not horizontal menus. The reason is horizontal menu UL elements are blocks and, thus, run the full width of the page. The LI elements are floated. So the top and bottom borders will always be wider than the actual width of the menu.

Long story short, here’s what I’ve come up with. I’ve applied a border on all four sides of the anchor elements. I then apply a negative margin on the parent LI element. Because the negative margin is on a different (parent) element, IE6 (and earlier) won’t cut off the extreme edge. Great! Problem solved!

Not so fast.

Vertical menus that have a negative bottom margin on the LI elements creates the same text-jog issue seein in menu #3 of the IE7 demo I prepared for Microsoft. In that instance, triggering hasLayout on the anchor elements resolved the issue. But now I’ve found that even with anchors having layout the bug can still be triggered. So it’s not a hasLayout issue, but something else entirely.

But there is a fix. It seems negative TOP margins are okay. So setting a negative top margin on the LIs still gives the overlapping of borders I want on IE6 and IE7 but without triggering the vertical text jog found in IE7.

It’s ridiculous.

But let it be known, that vertical text-jog seen in that IE7 demo is NOT directly related to hasLayout. Rather forcing the child anchor to have layout forces something else to happen on the parent LI element that prevents this text jog.

I really can’t wait to be done with rMenu. I want this monkey off my back.

Advertisements

2 thoughts on “More IE Oddities

  1. Why is it that:

    #variables[“msg”]#

    Is going to go right to the variables scope when I can create something like:

    #form.variables[“msg”]#

    and it’s a valid variable. if #variables[“msg”]# doesn’t exist, I’d get an error message rather than CF outputing the value of #form.variables[“msg”]# whereas if we had:

    #msg# and #form.msg#

    and #msg# wasn’t in the variables scope, outputting #msg# would output the form scoped version of the variable.

    It’s way too messy. Way too easy to make mistakes. This needs to be cleaned up.

  2. No offense but I find that a really silly example. Why would you use a name like that for a structure let alone use a reserved word. Well whether if its set as reserved I’m not sure but I’ve never gotten anything like that. You have to understand CF wasn’t built to be a programming language. Its not designed for hardcore programmers that get off with C++ type syntax (despite their being a cfscript tag which ain’t all that bad).

    ColdFusion by default will default to a set of scopes if you don’t have one defined. The reason for this I’m not sure but its hardly a complaint in the community. A best practice is to always scope your variables as well as giving them meaningful names. In fact thats what gets a lot of noobs into CF faster than say PHP which has a much steeper learning curve.

    I’m not surprised you have run into an application that runs poorly although I think thats a poor excuse. An application is only as good as its developer. Unfortunately, we can run into many poorly developed applications regardless of the language.

    Its always been suggested not to use cfregistry and cfexecute but they are there for a reason. I’ve never needed them and they are out of my range but I find that hardly a complaint. I do know of some developers who have found it very useful. I think Ben Nadel might have posted about it.. I can’t remember now.

    Again I have to state thats the whole point of the language, that its very forgiving. Which can be a large downside for CF as it can lead to very bad code but the community is passionate about providing standards and teaching best practices. I do my best to keep that going.

    Whats wrong with cfparam?? It’s a great tag and good practice in CF to use. How does that lead to lazy programming?? CF provides everything we need to interact with variables. We can create them, create them if they don’t exist, validate them, and easily, very easily throw our own custom errors if something goes wrong. I have seen several top developers putting their custom error throws in their code which I think is great practice. Developers are accounting for possible issues that might occur at runtime to provide helpful info to an admin/dev.

    Flash has its place and I think its a great combination with CF. It’d be really silly not to think that Macromedia (now Adobe) wouldn’t want to combine several of its most top technologies. Talk about a great feature to sell! Is Flash the best and should be used on everything? No of course not but its a great addition.

    My biggest gripe though probably is about cfquery. That alone is a reason to use CF over another language. Connection strings are sooo 90’s if you ask me. It does such a great job of escaping characters and damn that cfqueryparam tag rocks! They have now a built in result structure that is returned from the query in MX7. Which proves very helpful for debugging. I haven’t forgotton my days with ASP where I had to always escape single quotes in my queries, talk about horrifying. If anything CF does it best.

    Sorry for the long message. :( I love your work and always enjoy a good CF discussion although I’m not the most experienced developer I try to offer what knowledge and help I can.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s