I have a HTML document with some hardcoded content in it. This content needs to be moved to a database so I have jQuery helping me with some html manipulation left and right to batch some queries. As I want to insert valid xhtml into the database <br> won't do. But I understand that how these self closing tags are handled in browser specific? It would make more sense to me if the browser would just handle HTML syntax according to the specified doctype...
On Mar 26, 4:33 pm, Martijn Houtman <martijn.hout...@gmail.com> wrote: > On Mar 26, 2009, at 4:19 PM, bart wrote: > > > For each match it creates a div which holds the HTML in text format. I > > noticed that it transformed a line break <br /> to <br> (without the > > slash) what causes this behavior? Does this only happen with self > > closing tags? Can I prevent it all together? > > I believe XHTML is the only version that enforces a break element to > be self-closed. The rest accept (or even define) <br>, rather than > <br />. Browsers (luckily?) are very forgiving, so they rewrite <br / > > to <br> internally. That is probably why you get them back like that. > > Exactly why would you want to prevent the browser from rewriting it? > > Regards, > -- > Martijn.