[whatwg] Hacking away on forms ... (fwd)

Dave Raggett wrote:
> For traditional HTML elements, IE uses its built-in knowledge of
> their content model, along with rules for dealing with malformed
> HTML markup.
> 
> For other elements the behavior depends upon whether the tag
> has a namespace prefix or not.
> 
> If the tag doesn't have an XML namespace prefix, then it is
> inserted into the DOM as an empty upper case element.
> 
>   <foo>     nodeName = "FOO"
>   </foo>    nodeName = "/FOO"
>   <foo/>    nodeName = "FOO"
> 
> The same is true if you define the XML namespace with the
> xmlns attribute e.g.
> 
>   <foo xmlns="http://example.com/ns"/>  nodeName="FOO"

So far, that's correct.

> BUT if you use a tag with a previously defined XML namespace
> then things are different:
> 
>   <f:foo>hello world</f:foo>
> 
> is parsed as a foo element with a text node "hello world" as its
> content. The case for the element's tag name is preserved.


My tests show that the namespace does not have to be previously 
decalred, the results (as far as the tagName is concerned) are the same 
either way.

> if the namespace prefix isn't previously declared then you get:
> 
>   <f:foo>    nodeName = "F:FOO"
>   </f:foo>   nodeName = "/F:FOO"

Please publish a test case demonstrating this.  My tests show the same 
result is achieved regardless of whether the namespace is declared.

> It isn't sufficient to define the namespace on the element itself
> as in the following example:
> 
>   <g:fred xmlns:g="">smith</g:fred>
> 
> which gets the uppercase empty element treatment.

That's not what I get either.  My tests showed the tag name in lowercase.

> Elements with a declared XML namespace prefix can be styled
> with CSS.

How can the be styled in a way that is affected by the namespace 
declaration?  My tests show that the only way to style such an element 
is like the following and it will apply regardless of whether its 
namespace is declared.

f\:foo { background: green; }

<f:foo>test</f:foo>

> Note that my tests were done using a script to walk the DOM
> tree and display the results in an alert box.

My tests were done using your supplied sample markup and the Live DOM 
Viewer, which uses a similar approach.

http://software.hixie.ch/utilities/js/live-dom-viewer/

> None of this is insurmountable by a determined scripter, but we
> might perhaps try and aim for closer alignment amongst different 
> browsers that is currently the case. I am not advocating that
> Opera follows IE's upper case/empty element weirdness, rather
> that Opera treat <foo/> as an empty element.

How about we just forget about the crazy notion of introducing 
pseudo-XML syntax and handling into HTML.  If XHTML really is the future 
(as many people, including myself, have claimed), then we really don't 
want to destroy it by allowing it to be used and abused like HTML?the 
very thing it was designed to replace!

Please provide test cases demonstrating every result you obtained, 
especially where my tests have given different results.

-- 
Lachlan Hunt
http://lachy.id.au/

Received on Sunday, 10 September 2006 03:47:47 UTC