14 Jan 2014 shlomif   » (Master)

Tech Tip: Empty tag in XHTML served as text/html

If you serve XHTML (= HTML written using XML grammar and conventions) as Content-Type: text/html, you may be tempted to write an empty <div> tag as a standalone XML tag with a trailing slash using <div id="my_anchor" />. Don’t do that, and instead write a pair of opening and closing tags, e.g: <div id="my_anchor"></div>.

Using the first form confused both Firefox (24.2.x in my case) and Google Chromium (whatever shipped with Mageia at the time), and made them misrender my page, despite the fact that it validated as valid XHTML. Perhaps I should have considered putting the id=".." inside a meaningful sub-section of the document, but I implemented something for skipping a section navigation menu.

Syndicated 2014-01-14 14:25:58 from shlomif

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!