XHTML 1.1 and Firefox

HTML, CSS and anything else that deals with client side capabilities.

Moderator: General Moderators

User avatar
Sindarin
Forum Regular
Posts: 521
Joined: Tue Sep 25, 2007 8:36 am
Location: Greece

XHTML 1.1 and Firefox

Post by Sindarin »

Is there any reason why Firefox removes ending slashes from xhtml 1.1 documents?

e.g. <input type="text" /> is now <input type="text">
User avatar
kaszu
Forum Regular
Posts: 749
Joined: Wed Jul 19, 2006 7:29 am

Re: XHTML 1.1 and Firefox

Post by kaszu »

It's just how it works, I don't think W3 has specified how it should be (I didn't found anything about it), so they implemented it as they wanted.
edit: FF does that for all doctypes. Safari also does it.
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: XHTML 1.1 and Firefox

Post by jackpf »

Are you actually serving your pages as XHTML?? If not, then firefox will convert it to HTML in order to display it.
User avatar
Sindarin
Forum Regular
Posts: 521
Joined: Tue Sep 25, 2007 8:36 am
Location: Greece

Re: XHTML 1.1 and Firefox

Post by Sindarin »

Yes, I have the correct doctype and syntax. I guess I found what it is. When you 'view source' it shows alright but if you 'view selection source' it seems it converts it to plain html because Firefox can't find the doctype.
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: XHTML 1.1 and Firefox

Post by jackpf »

Sindarin wrote:Yes, I have the correct doctype and syntax.
But what content-type are you setting? ;)
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: XHTML 1.1 and Firefox

Post by pickle »

When you "view source", you view the code as it was first sent to the browser. When you "view selection source", you are viewing the current source code - complete with any changes Firefox may have made, as well as any code changes resulting from Javascript.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
Sindarin
Forum Regular
Posts: 521
Joined: Tue Sep 25, 2007 8:36 am
Location: Greece

Re: XHTML 1.1 and Firefox

Post by Sindarin »

Ah, thanks for clearing it up.
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: XHTML 1.1 and Firefox

Post by jackpf »

No, seriously what content-type are you setting?!?!

Surely firefox wouldn't need to convert XHTML to HTML if it is served as XHTML. I would have thought it only need convert it if the content-type is set as HTML...that way it has to validate it all and stuff. With XHTML there's no need.
User avatar
Sindarin
Forum Regular
Posts: 521
Joined: Tue Sep 25, 2007 8:36 am
Location: Greece

Re: XHTML 1.1 and Firefox

Post by Sindarin »

If that's what you want:

Code: Select all

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: XHTML 1.1 and Firefox

Post by jackpf »

Yeah...you're sending it as text/html. If you want it to render as XHTML, you have to send it as application/xhtml+xml or something similar. That's probably why it's being converted...
User avatar
Sindarin
Forum Regular
Posts: 521
Joined: Tue Sep 25, 2007 8:36 am
Location: Greece

Re: XHTML 1.1 and Firefox

Post by Sindarin »

D: Wow, there is a need to actually define a different content type for xhtml documents? How come the w3c validator didn't catch this in my code?

btw, I've seen <?xml version="1.0" encoding='UTF-8'?> tags on some pages, is this necessary as well for xhtml documents?
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: XHTML 1.1 and Firefox

Post by Eran »

please don't try to serve it as xml.. you're entering a world of pain
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: XHTML 1.1 and Firefox

Post by jackpf »

If you validate your page with the "mobile validator" or whatever it is, I think you get warned about sending the wrong content-type...

But the thing is, IE doesn't understand XHTML at all, and will prompt the user to download the page since it can't display it...despite it stating that it accepts all content types in its headers. So most people still send their pages as HTML. But then obviously the advantages of XHTML's rendering speed are lost since the browser will have to validate and convert it all.

With XHTML, since invalid syntax results in an error, the browser doesn't need to validate it...so in theory, it should be faster.

You could do a bit of user agent sniffing to check for IE, and send the relevant content-type headers.

And I'm not entirely sure about the <?xml....> tbh :? I suppose that stricly, yes...there should be an XML declaration. But since XHTML isn't actually XML I don't think it's required.

Anyway, that's all what I've heard :) Hope this helps...
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: XHTML 1.1 and Firefox

Post by jackpf »

pytrin wrote:please don't try to serve it as xml.. you're entering a world of pain
Surely that's the point of XHTML 8O
User avatar
Sindarin
Forum Regular
Posts: 521
Joined: Tue Sep 25, 2007 8:36 am
Location: Greece

Re: XHTML 1.1 and Firefox

Post by Sindarin »

please don't try to serve it as xml.. you're entering a world of pain
Oh yes! Whip me more Mistress w3c! 8O

I am confused now. I think I should migrate back to html as xhtml is "kind of" discontinued D:
Post Reply