W3C home > Mailing lists > Public > www-validator@w3.org > May 2009

Re: 1 element becomes 2

From: Melody Chamlee <developer@pobox.com>
Date: Wed, 20 May 2009 18:59:15 -0400
Cc: www-validator@w3.org
Message-Id: <26610EBE-3203-4609-B224-B6C5BFDF15CA@pobox.com>
To: "Michael A. Peters" <mpeters@mac.com>
Thanks Michael,

This is useful very info.  Much appreciated.

Coincidentally, commercial developers are often put in situations  
where they must support third party scripts due to time constraints or  
non-negotiable functionality.  Clients often dictate support of IE  
first. AJAX, flash, etc.

When translating an approved site concept into a workable and reusable  
content framework, Firefox is less forgiving and so I use it first to  
test and tweak a layout.

For efficiency I stick to traditional HTML standards as much as  
possible because 99% compliant HTML is 98% of the way to 100%  
compliant XHTML.  I only tweak what is required, starting with the DTD  
and closing of tags where required in order to generate validator- 
approved XHTML.  I validate because it's easier to support more users  
on different platforms.   I'd assume many commercial developers are  
using the validator for the same reason.  A standardized document is  
easier to modify while still supporting the most platforms.  It's also  
quicker, faster and cheaper for these reasons in the long run.  Coding  
to a strict DTD is actually easier than transitional for multi-browser  
support, which is a good sign standardization is making progress.

There are still nonstandard elements needed at times to achieve  
certain required functionality.  You make the call based upon customer  
needs.  But XHTML standards will stay relevant if the majority of  
commercial designers stick with standard code, if not for the benefit  
of future display innovation, then to benefit themselves as efficient  
developers.

Cheers

On May 20, 2009, at 3:58 PM, Michael A. Peters wrote:

> Jukka K. Korpela wrote:
>> Hannes Kirsman wrote:
>>> is this a bug of firefox or w3c validator?
>> No, it's an error in your document. Technically, it might not be an  
>> error (impossible to say without a URL), but in that case it's a  
>> matter of your misunderstanding.
>>> I have <a href="" /> tag
>> Why?
>> You should not use XHTML in the first place, unless you really know  
>> what you are doing, and 99% of XHTMLers don't.
>
> Just to explain the problem - if your server sends the document with  
> the 'application/xml+xhtml' mime type, browsers like Internet  
> Explorer will not render the document but instead will ask the user  
> what application they want to open it with.
>
> OTOH if you send text/html as the mime type, you are not standards  
> compliance.
>
> The way around it is to detect whether or not the browser supports  
> xhtml (via the $_SERVER['HTTP_ACCEPT'] header the browser sends to  
> the server) before sending the document, and only send the xhtml  
> version of the page to browsers that advertise they know what to do  
> with xhtml - sending html version of document to browsers that don't.
>
> That generally requires constructing your document with something  
> like php's DOMDocument class so that you can fairly easily send the  
> right type of document [via saveXML() or saveHTML()] to the  
> requesting browser.
>
> Another problem is that with x(ht)ml, you must make sure there are  
> no xml violations or it will not display. Again that is best  
> accomplished using an XML class to fully construct the document and  
> then exporting to xml when sending to the client.
>
> Yet another problem is that xml doesn't give the latitude in comment  
> content. IE -
>
> <script language='javascript'>
> <!--
> ...
> -->
> </script>
>
> often results in invalid xml, you have to use cdata sections instead.
>
> Yet another issue (for some people, not me - I don't use third party  
> javascript), if you declare your document to be xhtml, it seriously  
> limits the number of third party javascript libraries you can use,  
> because most do not conform to DOM2 specification for client side  
> dynamic alteration of xhtml.
>
> All that being said, I wish more of the web was xhtml. Until  
> Microsoft adds proper xhtml parsing to their browser (not even there  
> in IE8) most of the web will remain html.
>
>> Even if you use XHTML, you should not use self-closing tags for  
>> anything but elements with EMPTY declared content, as both XML and  
>> XHTML specs say. If you didn't understand this, you _surely_ should  
>> not use XHTML!
>
> Even with empty content, some (all ??) get it wrong.
> <a id='foo' />
>
> is legal valid xhtml but most (all ??) browsers will incorrectly  
> parse it, so you have to use
> <a id='foo'></a>
>
> Self closing script tags can also be problematic with some browsers.
>
> These are browser bugs, but unfortunately they are bugs you have to  
> deal with, and even once fixed, many people rarely update their  
> browsers. I still see IE6 quite often and even sometimes Netsape 4  
> in my server logs, and I only run a couple special interest websites.
>
Received on Wednesday, 20 May 2009 23:02:54 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 25 April 2012 12:14:35 GMT