Dave Raggett wrote:
You can reproduce my tests by pointing your browser at:

  http://people.w3.org/~dsr/dom/test.html

OK, I have the discovered the reason for the discrepancy in our results. Apparently IE handles exactly the same markup differently depending upon how it is added to the page.

If you load my test case [1] in IE, tests A through E are styled, but test F isn't. This shows the following:

IE will only allow styling of elements with namespace prefixes that have been either explicitly or implicitly declared.

There are two ways to explicitly declare a namespace in IE:
1. <html xmlns:foo="http://example.org/foo";>
2. <?xml:namespace prefix = foo ns = "http://example.org/foo"; />

In both cases, the URI may be omitted.

When a "Custom Tag" (the name Microsoft have given elements with namespace prefixes in HTML) is added using either innerHTML or document.write(), the PI that declares the namespace will be implicitly generated using the prefix but with no actual namespace name.

This explains why I was getting different results using the Live DOM Viewer because it uses innerHTML to copy the markup from the text box to the rendering area. That means that IE was implicitly declaring the namespace of all Custom Tags in my tests.

[1] http://lachy.id.au/dev/2006/09/custom-tags

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

Reply via email to