W3C home > Mailing lists > Public > public-html@w3.org > September 2007

Re: New elements vs. Trident

From: Maciej Stachowiak <mjs@apple.com>
Date: Mon, 17 Sep 2007 00:09:38 -0700
Cc: Dean Edwards <dean@edwards.name>, Dão Gottwald <dao@design-noir.de>, "public-html@w3.org WG" <public-html@w3.org>
Message-Id: <3FD34FAC-A132-4D57-9689-330C62F7808F@apple.com>
To: Robert Burns <rob@robburns.com>


On Sep 16, 2007, at 11:16 PM, Robert Burns wrote:

> Hi Dean, Maciej, and Dão,
>
> On Sep 16, 2007, at 8:30 PM, Dean Edwards wrote:
>
>>
>> Dão Gottwald wrote:
>>> Dean Edwards wrote:
>>>> html\:newelement {
>>>>  /* some style */
>>>> }
>>> IE doesn't handle XHTML, so I suppose you mean good old HTML with  
>>> pseudo-namespaces?
>>
>> Yes.
>
> Many keep referring to this as a hack or using the phrase pseudo- 
> namespaces. However, if we include this in HTML and it happens to  
> degrade gracefully in current and past versions of IE that is not  
> really a hack or anything pseudo about it (though its not  
> necessarily the same as namespaces in XML, it could be made to match  
> it as much as is practical) [1].

1) One weakness of this approach is that it won't work as expected in  
any browser other than IE. Consider the test case below (served as  
text/html):

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:html="http://www.w3.org/1999/xhtml 
">
<body>
<html:figure id="fig">
<img src="image" />
<label>some image</label>
</html:figure>
<script>
function test(s) { alert(s + ": " + eval(s)); }
test('document.getElementsByTagName("figure").length');
test('document.getElementById("fig").tagName');
test('document.getElementById("fig").namespaceURI');
test('document.getElementById("fig").localName');
</script>
</body>
</html>

Safari, Opera and Firefox all return 0 for the getElementsByTagName  
operation and return "html:figure" instead of "figure" as the tag  
name. So, to use this technique to make content that works right in  
all current browsers would require one of the following:

1.a) Serve as text/html to IE but application/xhtml+xml to other  
browsers, however this is likely to cause other interoperability  
problems. For instance on my test case below, IE in html mode gives  
"figure" as the tagName but other browsers in xml mode give  
"html:figure".

1.b) Use IE conditional comments to show the tag name html:figure to  
IE but the tag name figure to other browsers. However, this requires  
some ugliness at every open and close tag for a new element, whereas  
script-based fixup approaches

1.c) Use the namespaced names and use script-based fixup for all  
browsers besides IE to replace the "html:figure" element with a  
"figure" element.

2) This pseudo-namespace approach does not appear to be capable of  
creating native HTML elements. For example, adding <html:input  
type="text" /> to the above example doesn't add anything to the  
rendering.


Overall, this approach does not seem much stronger as an approach to  
graceful degradation, than the canonical approach of putting the  
proper unqualified tag name in the markup and using script fixup for IE.

It may be independently desirable to copy IE's namespaces in HTML  
support as an open-ended extensibility mechanism. But as far as  
preparing for HTML5, it seems like adding it to all non-IE browsers is  
a higher barrier than fixing IE's unknown tag parsing.


Regards,
Maciej
Received on Monday, 17 September 2007 07:09:50 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 9 May 2012 00:16:07 GMT