[whatwg] Hacking away on forms ... (fwd)
dsr at w3.org
Sun Sep 10 03:17:19 PDT 2006
On Sat, 9 Sep 2006, Anne van Kesteren wrote:
> On Fri, 08 Sep 2006 18:40:34 +0200, Dave Raggett <dsr at w3.org> wrote:
>> p.s. implementing the output element would be a lot cleaner if
>> more browsers supported the /> syntax for empty elements that
>> aren't part of traditional HTML. IE already does so, but Firefox
>> and Opera do not. Firefox is even worse as it coerces the tag
>> name to upper case when you inspect the DOM node it creates!
>> Opera and Firefox also differ over the amount of whitespace text
>> nodes that are set as the content on unknown elements. IE has its
>> own weird worts, although strangely, it works rather nicely for
>> non-html markup in XML namespaces. IE therefore encourages the
>> use of XML namespaces for mixed markup when delivered as
> You sure IE only does this for <foo/> and not also for <foo>? It's
> my understand they are treated as being identical in every single
> browser. Whether or not such an element is treated as empty varies
> from browser to browser.
For traditional HTML elements, IE uses its built-in knowledge of
their content model, along with rules for dealing with malformed
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"
BUT if you use a tag with a previously defined XML namespace
then things are different:
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.
if the namespace prefix isn't previously declared then you get:
<f:foo> nodeName = "F:FOO"
</f:foo> nodeName = "/F:FOO"
However, the namespace declaration can leave the URI empty, e.g.
is sufficient for IE to avoid giving <f:foo> the empty uppercase
It isn't sufficient to define the namespace on the element itself
as in the following example:
which gets the uppercase empty element treatment. To avoid
that, you need to declare the namespace on the html start tag.
Elements with a declared XML namespace prefix can be styled
Note that my tests were done using a script to walk the DOM
tree and display the results in an alert box.
With a knowledge of the above behavior, web page scripts can
be written clean up the DOM, e.g. placing the tags into the
HTML namespace with a dynamically defined prefix, and fixing
up the content. It's not a show stopper.
> Converting the node name to uppercase also seems like the right
> thing to do for text/html documents although HTML5 might change
> bits of that...
Another difference between IE and Opera is that Opera includes
the prefix as part of the node name for elements with a previously
declared XML namespace.
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.
Dave Raggett <dsr at w3.org> W3C lead for multimodal interaction
http://www.w3.org/People/Raggett +44 1225 866240 (or 867351)
More information about the whatwg