Uppercase table tags create extra whitespace in WordPress

When creating tables inside a WordPress post, using uppercase TABLE and/or TR tags causes additional whitespace to appear above the table. I say and/or TR tags because uppercase TABLE tags alone don't seem to create additional whitespace, however uppercase TR tags do. If you combine the use of uppercase TABLE and TR tags together, they create even more whitespace!

First, lets see what normal output looks like:

[html]
This is a simple sentence used to demonstrate an odd spacing effect when uppercase TABLE and TR tags are used in a table.

[/html]

WordPress output:

And now, if we copy the exact same content and make the TABLE and TR tags uppercase, look what happens:

[html]
This is a simple sentence used to demonstrate an odd spacing effect when uppercase TABLE and TR tags are used in a table.

[/html]

WordPress output:

I'm running the latest version of WordPress (v2.3.1 as of this post) and I have confirmed this oddity appears on multiple platforms (Mac OS X 10.4.11, Windows XP SP2) with multiple browsers (Firefox 2.0.0.11 on Windows and OS X, Internet Explorer 6.0.29 and Opera 9.22 on Windows, and Safari 3.0.4 on OS X).

Upon closer inspection of the actual output produced by WordPress in my browser (using view source), I discover the problem:

Browser output of the lowercase example:

[html]

This is a simple sentence used to demonstrate an odd spacing effect when uppercase TABLE and TR tags are used in a table.

[/html]

Browser output of the uppercase example:

[html]

This is a simple sentence used to demonstrate an odd spacing effect when uppercase TABLE and TR tags are used in a table.

[/html]

It appears that WordPress is looking for the <table> and <tr> tags and when it finds them it doesn't automatically add <br /> and <p> tags around them like it does with the rest of your post. (I don't use the visual editor, so I'm able to easily add hand-written HTML directly to my post.) However, the search for <table> and <tr> must be case sensitive which causes problems if your tags are anything but lowercase.

I would normally report this as a bug to WordPress, but I'm sure the reply will be that all XHTML must be lowercase and so the problem is not relevant. I say that's bad backwards compatibility. 😐

Write a Comment

Comment