Re: Why HTML should be taught as HTML without pretending it is XML

On Mon, 23 Jul 2007 20:21:21 +0200, Robert Burns <rob@robburns.com> wrote:

>> Consistency is not an issue.
>>
>> The issue is that, per spec, createElement() creates an element *in no  
>> namespace*. Not in the HTML namespace. Only Safari follows the spec on  
>> this point. Firefox uses the HTML namespace if the Document node  
>> implements the HTMLDocument interface (which is when you use  
>> application/xhtml+xml). Opera uses the same namespace as the root  
>> element's namespace.
>>
>>    http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-2141741547
>>
>
> It certainly is a matter of consistency. If one sticks with only non- 
> namespace method calls, it will work with all three of those approaches

It won't. If you say e.g. document.createElement("input"), it will not be  
a form control in Safari (which is per spec). It will not implement the  
HTMLInputElement interface, nor the HTMLElement interface for that matter.  
It is equivalent to having <input xmlns=""/> in the markup. It does not  
matter if you only use non-namespeced methods through-out and only one  
namespace in the document -- createElement() will never create HTML  
elements in an XML context.

> [...]

-- 
Simon Pieters
Opera Software

Received on Monday, 23 July 2007 18:49:20 UTC