Re: xlink:href test case

On 4/16/10 4:32 AM, Robin Berjon wrote:
> I'm okay with the first, but the second is a problem because if the prefix is unbound the document cannot then be serialised to XML.

Why is this an issue?  It's trivial to construct DOMs using 
setAttributeNS that can't be serialized as XML without fixup.  Actual 
serializers in browsers munge namespace prefixes as needed to produce 
well-formed XML that will at least end up with the same localNames and 
namespaces; prefixes are not considered something that has to round-trip 
(though it's nice when they do, and serializers try to preserve them 
when possible).

> The following might work:
>
> Given setAttribute("foo:bar", "unidahut"),
>
>    - if there is an attribute the qualified name of which is "foo:bar", its value gets updated
>    - if there is no such attribute, but there is a namespace in scope for prefix "foo", then a foo:bar attribute is created with that prefix and that namespace

This isn't compatible with what UAs do now, last I checked.  Are we sure 
this won't break sites?

>    - if there is no such attribute and no matching namespace in scope, a "bar" attribute is created, with no prefix and in no namespace

This will _definitely_ break sites if applied to HTML.

-Boris

Received on Saturday, 17 April 2010 02:15:34 UTC