A Cake For Firefox

Cake For FirefoxFirefox recently released Firefox 2.0. There was a little slip-up with that release though, it hit some FTP servers earlier than it should have.

Anyway, the Internet Explorer team at Microsoft sent a cake to the Firefox team, congratulating them on their release of Firefox 2.0. Pretty weird huh? One would expect the cake to be full of poison, but that’s not the case. It’s simply a “job well done” present from the IE dev team to the Firefox guys.

It’s nice to see archenemies sending such nice gifts, even if it is Microsoft that’s involved. Can you feel the love?

Wrapping Text Inside Pre Tags

I sometimes display little snippets of code on this site. For example, here, here, and here. To do this, I use the Code Markup wordpress plugin.

If you’re using Firefox, you may notice the long lines in my Digg Integrator fix post. It’s not really a problem for me having those really long lines in Firefox. Why? Because Firefox still displays my sidebar correctly. Internet Explorer is a totally different story though. When there’s long lines like that, my sidebar will appear at the very bottom of the page in IE.

The long lines are caused by use of the pre html tag. The pre tag preserves spaces and line breaks in a chunk of text. Perfect for displaying snippets of code. However, some lines of code are quite long and will run off the page. This is exactly why my sidebar was getting pushed to the bottom of the page in IE.

So, I set out looking for a method to wrap text contained within pre tags. Google found exactly what I was looking for. Wrapping text inside pre tags is quite easy, all that’s required is a simple addition to your css:

pre {
 white-space: pre-wrap;       /* css-3 */
 white-space: -moz-pre-wrap;  /* Mozilla, since 1999 */
 white-space: -pre-wrap;      /* Opera 4-6 */
 white-space: -o-pre-wrap;    /* Opera 7 */
 word-wrap: break-word;       /* Internet Explorer 5.5+ */
}

Quite simple. After adding that CSS, the text in pre tags still doesn’t wrap in Firefox, but I don’t care because Firefox displays the rest of my page as it should. Now, when you view a page in IE with a long line, the text is wrapped and my sidebar content appears at the top of the page instead of the bottom.

For consistency sake, let’s make these long lines wrap in Firefox too. This is extremely simple. It only requires adding a few characters to the CSS shown above. For text wrapping in Firefox, use this CSS:

pre {
 white-space: pre-wrap;       /* css-3 */
 white-space: -moz-pre-wrap !important;  /* Mozilla, since 1999 */
 white-space: -pre-wrap;      /* Opera 4-6 */
 white-space: -o-pre-wrap;    /* Opera 7 */
 word-wrap: break-word;       /* Internet Explorer 5.5+ */
}


Notice the only difference between the first and second examples is the addition of “!important” to the third line in example 2. After adding that little bit, your text between your pre tags should wrap well in basically every browser that’s currently in use.

UPDATE 3/10/2007

If you can’t seem to get the css above to work, give the css below a shot. I just set a width on the pre tag. When the width is set to 100%, you’ll get a horizontal scrollbar when viewing in IE7. That’s why I’ve set the width to 99%. The code will display just fine in IE6, IE6, and FireFox when width is set to 99%. I have not tested Opera. Try this updated CSS if you’re having issues with the original CSS from above.

pre {
 white-space: pre-wrap;       /* css-3 */
 white-space: -moz-pre-wrap !important;  /* Mozilla, since 1999 */
 white-space: -pre-wrap;      /* Opera 4-6 */
 white-space: -o-pre-wrap;    /* Opera 7 */
 word-wrap: break-word;       /* Internet Explorer 5.5+ */
 width: 99%;
}

UPDATE 6/4/2008

Markku Laine posted some css in a comment that seems to work better than the original css I posted. It works in IE, Safari, and FireFox. Try using Markku’s css below if the previous examples don’t work for you.

pre {
 overflow-x: auto; /* Use horizontal scroller if needed; for Firefox 2, not needed in Firefox 3 */
 white-space: pre-wrap; /* css-3 */
 white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */
 white-space: -pre-wrap; /* Opera 4-6 */
 white-space: -o-pre-wrap; /* Opera 7 */
 /* width: 99%; */
 word-wrap: break-word; /* Internet Explorer 5.5+ */
}

Update 1/20/2011

Some code Max posted in a comment also seems to be working well for many people. It may be worth trying as well:

height: 120px;
overflow: auto;
font-family: “Consolas”,monospace;
font-size: 9pt;
text-align:left;
background-color: #FCF7EC;
overflow-x: auto; /* Use horizontal scroller if needed; for Firefox 2, not
white-space: pre-wrap; /* css-3 */
white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */
word-wrap: break-word; /* Internet Explorer 5.5+ */
margin: 0px 0px 0px 0px;
padding:5px 5px 3px 5px;
white-space : normal; /* crucial for IE 6, maybe 7? */

Shiny New Firefox Theme

So, I just installed the “nightly” Mozilla Firefox 2.0 Beta 2 RC1. It’s a whole lot more stable than Firefox 2.0 Beta 1 was.
tlongren
I really like this new default theme. It’s much prettier, although I don’t really like some of the icon choices.

In addition to the new theme, there’s also some apparently new functionality when downloading .exe files. Every time I download a .exe it pops up a window saying “You have chosen to open blahblah.exe”. Only, it won’t let you open it directly, you gotta save it to your hard drive somewhere first.

I think I am going to stick with this release until FireFox 2.0 Beta 2 officially comes out, because as I said before, this is just a nightly build with the Beta 2 name RC1 name. This release has yet to crash on me, where Firefox 2.0 Beta 1 crashed roughly 10 times each day. Looks like the Mozilla team has been busy.

Performancing For Firefox 1.3

Performancing For Firefox 1.3 has been released. Lots and lots of changes are included in this release. There’s now support for themes and addons. The performancing team has also open sourced Performancing For Firefox, which means anyone can get the source code and modify it as they please.

Some of the new features are listed below:

I’m writing this post with this new version of Performancing. So far nothing unusual. The addons and themes API additions are sweet, hopefully some worthy developers will hack together some neat addons. I’m excited about this new version, it’s opened a lot more doors for Performancing.

More WordPress and some FireFox

UPDATE: Get SK2-WP2Compatibility, a plugin for Spam Karma 2. It fixes the comment count problem mentioned below when using Spam Karma 2 with WordPress 2.0. OK, just wanted to get that out in the open. Please continue.

Now that I’ve spent a little more time with WordPress 2.0 RC1, I’ve discovered a plugin compatibility problem that’s probably going to destroy me. Spam Karma 2 causes some problems when updating the “comment_count” value in the “wp_posts” table. It doesn’t just cause problems displaying comment numbers, I had to manually updated that field for some posts. But, it’s not like this type of thing wasn’t expected. I’m not brave enough to run slackware-current on my main workstation anymore, this works for me though.

So, I can either use Spam Karma and not have any comment counts for new or updated posts, or I can just stop using Spam Karma. I really don’t want to let Spam Karma go. I’ve already seen about 200 trackback/comment spams since disabling Spam Karma earlier today. I really hope to see a new release of Spam Karma that works with WordPress 2.0. I guess this problem was known about a few weeks ago. I somehow didn’t notice it when I upgraded to 2.0 beta 1 and then to 2.0 beta 2.

Anybody know of a comment/trackback spam WordPress plugin that’s known to work with 2.0? There’s the list in the support forums, which also happens to discuss the Spam Karma problems. I may see if the latest WordPress Hashcash will work at all.

There is good news though, not really relating to WordPress though. FireFox 1.5 stable is out! You can get FireFox 1.5 at the new official home of FireFox and Thunderbird, Mozilla.com.

Also, my favorite Mint Pepper has been updated to work with Mint 1.23. I was thinking of downgrading to Mint 1.14 just so I could have the Outclicks Pepper. Andrew Sutherland couldn’t have picked a better time to release his updated pepper.

CONTINUED UPDATE: Too bad I didn’t see this about an hour ago. Looks like I’ll get to keep my Spam Karma thanks to SK2-WP2Compatibility, a plugin for Spam Karma 2.

SK2-WP2Compatibility is a plugin for Spam Karma 2. It has no effect without Spam Karma 2.0 or higher being already installed on your WordPress system.
This plugin has no spam fighting or spam killing abilities. Instead, it is intended to provide a way by which all users moving to WordPress 2.0 can enjoy the benefits of Spam Karma – without having to worry about WordPress 2.0 specific changes.

Might not need that SK2 plugin for too long, there’s word of a Spam Karma 2.1 soon.