W3C home > Mailing lists > Public > public-html@w3.org > June 2008

Re: innerHTML in XML

From: Thomas Broyer <t.broyer@gmail.com>
Date: Sun, 1 Jun 2008 11:42:41 +0200
Message-ID: <a9699fd20806010242o31feae5dpbd26206b2a23474c@mail.gmail.com>
To: public-html@w3.org
On Sun, Jun 1, 2008 at 6:54 AM, Cameron McCormack wrote:
> Currently the spec says:
>  If any of the elements in the serialization are in the null namespace,
>  the default namespace in scope for those elements must be explicitly
>  declared as the empty string.
>    — http://dev.w3.org/html5/spec/#innerhtml1
> Is there any reason for this?  Why not allow elements to be in no
> namespace by virtue of there being no xmlns="" attribute in
> ancestor-or-self::*?

You might have misunderstood that sentence (or have I misunderstood yours?)

It says that if an element is in no namespace in the DOM, its
serialization must have xmlns="" (so that you can copy/paste it into a
document no matter whether there's a default namespace without
changing its meaning).
(note that the sentence appears in the context of a paragraph dealing
with the "return value" of innerHTML, so the process of serializing,
not parsing).

If the serialization didn't include the xmlns="" explicitly,
serializing a tree to, e.g.:
  <foo:a xmlns:foo="http://example.net/foo"><b/></foo:a>
Then compare pasting that fragment in the following documents:
  <c xmlns="">[paste here]</c>
  <d xmlns="http://example.net/foo">[paste here]</d>
Element <b/> wouldn't be the same when re-parsing the compound documents.

With the explicit xmlns="" in the serialization, this cannot happen:
  <foo:a xmlns:foo="http://example.net/foo" xmlns=""><b/></foo:a>

Thomas Broyer
Received on Sunday, 1 June 2008 09:43:15 UTC

This archive was generated by hypermail 2.4.0 : Saturday, 9 October 2021 18:44:32 UTC