Re: New elements vs. Trident

HI Maciej,

This works for me in Safari 3.0 beta with uppercase: i.e.,
"test('document.getElementsByTagName("HTML:FIGURE").length');"

Even though we're using namespaces, the HTML rules still apply to  
capitalization.

I also think that doing this is a great example of degrades  
gracefully because as other browsers add namespace awareness (in text/ 
html serialization) this will continue to work and will even work  
better since authors will be able to take advantage of other features  
of namespaces.

Obviously a lot more thought would have to go into this. However, I  
think that makes it even more suitable for the design principle since  
the examples in the design principles shouldn't be actual examples  
that WILL be in the HTML5 final recommendation. We can't predict  
that. However, something like provides a good example of the way  
we're going to apply the graceful degradation principles even if  
other factors outweigh that principle in this case.

Take care,
Rob

On Sep 17, 2007, at 2:09 AM, Maciej Stachowiak wrote:

>
>
> 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:32:10 UTC