Re: DOM L3 Core spec.: textContent specification ambiguity

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 UTC