Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 84721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T21:58:33+00:00 2026-05-10T21:58:33+00:00

I have noticed jQuery (or is it Firefox) will turn some of my <span

  • 0

I have noticed jQuery (or is it Firefox) will turn some of my <span class='presentational'></span> into <span class='presentational' />

Now my question is, is this okay to write my markup like this? Will any browsers choke on it?

Personally, I think it looks cleaner to do <span class='presentational' /> if it’s going to be empty.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T21:58:34+00:00Added an answer on May 10, 2026 at 9:58 pm

    I’m assuming your question has to do with the red trailing slash on self-closing elements when you view source in Firefox. If so, you’ve stumbled into one of the most vehement, yet simultaneously passive aggressive debates in the browser maker vs. web developer wars. XHTML is NOT just about a document’s markup. It’s also about how documents are meant to be served over the web.

    Before I begin; I’m trying hard not to take sides here.

    The XHTML 1.1 spec says that a web server should serve XHTML with a Content-Type of application/xhtml+xml. Firefox is singling out those trailing slashes as invalid because your document is being served as text/html rather than application/xhtml+xml. Take these two examples; identical markup, one served as application/xhtml+xml, the other as text/html.

    http://alanstorm.com/testbed/xhtml-as-html.php

    http://alanstorm.com/testbed/xhtml-as-xhtml.php

    Firefox flags the trailing slash in the meta tag as invalid for the document served with text/html, and valid for the document served with application/xhtml+xml.

    Why this is Controversial

    To a browser developer, the point of XHTML is you can treat your document as XML, which means if someone sends you something that’s not valid, the spec says you don’t have to parse it. So, if a document is served as application/xhtml+xml and has non-well formed content, the developer is allowed to say ‘not my problem’. You can see that in action here

    http://alanstorm.com/testbed/xhtml-not-valid.php

    When a document is served as text/html, Firefox treats it as a plain old HTML document and uses the forgiving, fix it for you, parsing routines

    http://alanstorm.com/testbed/xhtml-not-valid-as-html.php

    So, to a browser maker, XHTML served as text/html is ludicrous, because it’s never treated as XML by the browser’s rendering engine.

    A bunch of years ago, web developers looking to be more than tag monkeys (Disclaimer: I include myself as one of them) started looking for ways to develop best practices that didn’t involved thrice nested tables, but still allowed a compelling design experience. They/We latched onto XHTML/CSS, because the W3C said this was the future, and the only other choice was a world where a single vendor (Microsoft) controlled the defacto markup spec. The real evil there being the single vendor, and not so much Microsoft. I swear.

    So where’s the controversy? There are two problems with application/xhtml+xml. The first is Internet Explorer. There’s a legacy bug/feature in IE where content served as application/xhtml+xml will prompt the user to download the document. If you tried to visit the xhtml-as-xhtml.php listed above with IE that’s likely what happened. This means if you want to use application/xhtml+xml, you have to browser sniff for IE, check the Accepts header and only serve application/xhtml+xml to those browsers that accept it. This is not as trivial as it sounds to get right, and also went against the ‘write once’ principle that the web developers were striving for.

    The second problem is the harshness of XML. This is, again, one of those flame prone issues, but there’s some people who think a single bad tag, or single character improperly encoded shouldn’t result in a user not seeing the document they want to. In other words, yes, the spec says you should stop processing XML if it’s not well formed, but the user doesn’t care about the spec, they care that their cat’s website is broken.

    Adding even more gasoline to the issue is the XHTML 1.0 (not 1.1) spec says that XHTML documents may be served as text/html, assuming certain compatibility guidelines are followed. Things like the img tag being self closing and the like. The key word here is may. In RFC speak, may means optional. Firefox has chosen NOT to treat documents served with an XHTML doctype but a content type of text/html as XHTML. However, the W3C validator will happily report these documents as valid.

    I’ll leave the reader to ponder the simultaneous wonder/horror of a culture that writes a document to define what they mean by the word may.

    Moving Forward

    Finally, this is what the whole HTML 5 thing is about. XHTML became such a political hot potato that a bunch of people who wanted to move the language forward decided to go in another direction. They produced a spec for HTML 5. This is currently being hashed out in the W3C, and expected to finish sometime in the next decade. In the meantime, browser vendors are picking and choosing features from the in-progress spec and implementing them.

    Updates from the Comments

    In the comments, Alex points out that if you’re going to sniff for something, you should check the Accept header to see if application/xhtml+xml is accepted by the user agent.

    This is absolutely correct. In general, if you’re going to sniff, sniff for the feature, not for the browser.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Related Questions

Loading...

Sidebar

Ask A Question

Stats

  • Questions 55k
  • Answers 55k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer I think you'll want something along the lines of #!/bin/bash… May 11, 2026 at 7:42 am
  • added an answer X2 is an iterator and is delayed executed. It won't… May 11, 2026 at 7:42 am
  • added an answer (From Sara Ford's blog): Under the HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0 key create a… May 11, 2026 at 7:42 am

Top Members

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.