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

Re: Setting Node.textContent to null

From: Ms2ger <ms2ger@gmail.com>
Date: Wed, 29 Jun 2011 00:10:01 +0200
Message-ID: <4E0A5139.7020505@gmail.com>
To: www-dom@w3.org
On 06/28/2011 11:50 PM, Ms2ger wrote:
> On 06/28/2011 09:09 PM, David Flanagan wrote:
>> The textContent of Node has nullable type DOMString? because some node
>> types do not have text content and return null when this attribute is
>> queried.
>> This means, however, that as far as IDL is concerned, it is legal to set
>> the attribute to null on a node, and DOMCore needs to specify what
>> happens when textContent is set to null for an Element, DocumentFragment
>> or PI. (The Text and Comment cases are okay because CharacterData.data
>> is declared [TreatNullAs=EmptyString].)
>> It seems obvious that the right thing to do is to treat null as an empty
>> string, but I don't think that you can declare the attribute
>> [TreatNullAs=EmptyString] since that would alter the return value for
>> node types that do not have text content, wouldn't it?
> I attempted to clarify this; it's currently specified to match WebIDL in
> converting null to "null".

And I changed it to convert null to the empty string instead, to match 
current browsers.


Received on Tuesday, 28 June 2011 22:10:30 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:17 UTC