Had a brain fart this morning and accidentally wrote </br> instead of <br /> on an XHTML page. Funny thing was that whilst Firefox correctly ignored it, IE assumed it was a line break tag. Just thought I would post it as a slightly odd bug or quirk.
| SitePoint Sponsor |


Had a brain fart this morning and accidentally wrote </br> instead of <br /> on an XHTML page. Funny thing was that whilst Firefox correctly ignored it, IE assumed it was a line break tag. Just thought I would post it as a slightly odd bug or quirk.

Oddly enough, IE is more forgiving for errors that FireFox. I guess it comes from their "intuitive" interface. However, I would much rather write code the correct way so I am very grateful that FireFox doesn't put up with code shennanigans!![]()
Linda Jenkinson
"Say what you mean. Mean what you say. But don't say it mean." ~Unknown





I'm not 100% sure, but my guess would be that you can actually write break tags like this in XHTML:
The self-closing version is a shorthand. The IE parser just assumed that you forgot to type the opening tag and added it in for you.Code:<br></br>![]()


Yes you can write <br></br> though obviously it is not best practice.
Also Appendix C.2. Empty Elements has an example.
};-) http://www.xhtmlcoder.com/
Thinking Web: Voices of the Community
> March 2013 - SitePoint forums: Spot the Error 3: Calling all Sleuths! Winner Announced!... She knows how to spot simple <code> errors but do you?
Treating </br> as if it were <br> is a quirk that IE4 copied from NN4 I believe. Firefox has this quirk still in quirks mode. Same for stray </p>s (which are treated as <p></p>).
This has nothing to do with XHTML btw. This is a tag soup phenomenon that only lives in tag soup environments (text/html).
Simon Pieters
Given the fact that in theory <br /> could be written like <br></br>
Would that mean that if you were using a div for decoration on a page and it was empty that you could write it like <div class="corner" />![]()
If you serve as XML yes, text/html no. If you serve XHTML as text/html you must (according to RFC2854 which is referenced in section 5.1 in the XHTML 1.0 spec) follow appendix C, which means <br></br> and <div/> are disallowed.
text/html is always treated as HTML by UAs. </br> is invalid HTML (though HTML4 doesn't define error handling for it).
Simon Pieters
Bookmarks