Re: xmlns in HTML5

Henri Sivonen wrote:
> On Jul 17, 2009, at 17:13, Shane McCarron wrote:
> 
>> Henri Sivonen wrote:
>>> What you say is true for all practical purposes when talking about 
>>> "the DOM" in browsers. It's not necessarily true in practice and per 
>>> spec for all kinds of things called "the DOM".
>> Okay.  How about per the HTML5 spec?  If it is not, then we would like 
>> it to be.  To whom do we send that comment?
> 
> Per spec, what Sam said holds when the section 
> http://www.whatwg.org/specs/web-apps/current-work/#coercing-an-html-dom-into-an-infoset is 
> not invoked. When that section is invoked, then what Sam said doesn't 
> always hold. You may safely assume that browsers won't invoke the 
> section but other classes of products may.
> 
> You can send comments to public-html-comments or to public-html if you 
> are a participant in the HTML WG or to the WHATWG list if you are 
> subscribed to that list or you can file a bug in the W3C Bugzilla.
> 
> I don't expect 
> http://www.whatwg.org/specs/web-apps/current-work/#coercing-an-html-dom-into-an-infoset to 
> change substantially, because the rules recounted there are necessary 
> when you have an XML API that throws on certain things and you can't 
> change the API. (For example, if people want to use the JDK DOM, the JDK 
> DOM is what it is.)

I have tried the following with Firefox, Opera, IE, Safari, and Chrome. 
  Given that each show the attribute, that is the one thing I don't 
expect to change.  As to the spec, perhaps you are right and it may 
permit others to not interoperate with browsers and still claim to be 
conformant.

<html>
<head>
   <title>test colon in attributes name</title>
</head>
<body>
<ul id='list'></ul>
<script>
var list = document.getElementById('list');
list.setAttribute('xmlns:dc',
   'http://dublincore.org/documents/dcmi-namespace/');
var attrs = list.attributes;
var length = attrs.length;
for (var i=0; i<length; i++) {
   var value = attrs[i].nodeValue;
   if (!value) continue;
   value = value.replace(/&/, '&amp;').replace(/</, '&lt;').
                 replace(/>/, '&gt;').replace(/"/, '&quot;');
   var li = document.createElement('li');
   var text = document.createTextNode(attrs[i].nodeName+'="'+value + '"');
   li.appendChild(text);
   list.appendChild(li);
}
</script>
</body>
</html>

- Sam Ruby

Received on Friday, 17 July 2009 19:14:24 UTC