Oh, fer cryin’ out loud. Close the darn tag!

By James at July 22, 2009 09:18
Filed Under: Web Development, Ajax and Javascript

I’ve been working on a side project for a while now. A big AJAX-y web application with tons of moving parts. Last night I was getting ready to publish a version for the client to review when I noticed something odd when viewing in Internet Explorer 8. It started out peculiar, turning out to be extremely frustrating.

How a portion of the page looked in Firefox 3.5

 ff_render

 

And how the same page looked in Internet Explorer 8 (with and without Compatibility Mode) Notice how the font style changes at “State”.

ie_render

I spent a good amount of time trying to figure out what the heck was going on. Thinking I had hosed a style somewhere, I opened up Firebug and inspected the element. This is what I saw. Ok, looks normal to me.

ff_html

But using Internet Explorer’s Developer Tools, I saw this. Notice how the span does not close, and the rest of the elements are a child of the span tag.

ie_html

So, going over the HTML in the ASPX page, I find this, I hadn’t closed the span tag properly. DOH!

badcode

Fixing the markup like such, makes the page render properly.

goodcode

So, is this a bug or a feature of Internet Explorer 8? Or, a bug or a feature of Firefox 3.5?  For me the moral of the story is to make sure that all my block element tags are properly closed.

Time to code,

James

Comments (1) -

7/22/2009 9:35:09 AM #

Dennis

I had even more frustration when I did the same thing in the head title tag.
<head><title/><head> will prevent IE from rendering anything!

Dennis | Reply

Add comment




  Country flag
biuquote
  • Comment
  • Preview
Loading


About the author

James James is a five time and current Microsoft MVP in Client App Development, a Telerik Insider, a past Director on the INETA North America Board, a husband and dad, and has been developing software since the early days of Laser Discs and HyperCard stacks. As the Founder and President of the Inland Empire .NET User's Group, he has fondly watched it grow from a twice-a-month, early Saturday morning group of five in 2003, to a robust and rambunctious gathering of all types and sizes of .NET developers.

James loves to dig deep into the latest cutting edge technologies - sometimes with spectacular disasters - and spread the word about the latest and greatest bits, getting people excited about developing web sites and applications on the .NET platform, and using the best tools for the job. He tries to blog as often as he can, but usually gets distracted by EF, LINQ, MVC, ASP, SQL, XML, and most other types of acronyms. To keep calm James plays a mean Djembe and tries to practice his violin. You can follow him on twitter at @latringo.

And as usual, the comments, suggestions, writings and rants are my own, and really shouldn't reflect the opinions of my employer. That is, unless it really does.

James Twitter Feed

Recent Comments

Comment RSS

Month List