W3C home > Mailing lists > Public > www-dom@w3.org > April to June 2010

Re: DOM L3 Core spec.: textContent specification ambiguity

From: Robin Berjon <robin@berjon.com>
Date: Mon, 21 Jun 2010 14:24:23 +0200
Cc: <www-dom@w3.org>
Message-Id: <E43D8AC4-1D7B-4D2D-8174-A261C070C3FA@berjon.com>
To: Daniel Barclay <daniel@fgm.com>
Hi Daniel,

On Jun 8, 2010, at 19:43 , Daniel Barclay wrote:
> The wording in the definition of the textContext attribute of the
> Note interface seems to be ambiguous (or at least misleading).
> 
> The text says:
> 
>  "On getting, no serialization is performed, the returned string
>   does not contain any markup."
> 
> The intent of the latter part of that sentence is to say that the
> string does not contain any added markup to represent any child
> elements, etc.
> 
> However, that wording sounds like it's saying that the string cannot
> contain any text that looks like markup.

I find the sentence to be rather clear in fact. It says that the returned string contains no markup, which to me sounds like it's saying that it contains no markup; if it said that the returned string doesn't contain anything that could be mistakenly interpreted as containing markup, then it'd probably sound like it's saying that the string cannot contain any text that might perhaps look like markup. But it doesn't :)

> If the difference isn't clear, consider getting the text content of
> the root element of this document:
> 
>  <root><sub>&lt;e/&gt;</sub><root>
> 
> The textContent attribute string would be "<e/>", right?

Which is fine: it's not markup. It's just text. You can then go el.textContent = "<e/>" and it'll roundtrip because it's not markup.

> That string _does_ contain markup

No, it doesn't. That's like saying that the following XML document isn't well-formed because the "b" element isn't closed:

  <a><![CDATA[<b>]]></a>

-- 
Robin Berjon - http://berjon.com/
Received on Monday, 21 June 2010 12:24:53 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:14:04 GMT