[whatwg] Setting innerHTML to null or undefined

On Jun 4, 2007, at 5:45 PM, liorean wrote:

> On 05/06/07, Michael A. Puls II <shadow2531 at gmail.com> wrote:
>> On 6/4/07, Jonas Sicking <jonas at sicking.cc> wrote:
>> > I'd really dislike having to have this one property behave  
>> differently
>> > than other text properties in the DOM. How do opera/ie deal with  
>> other
>> > text properties like .src, .id, .textContent?
>>
>> For .src and .id, IE and Opera set "null".
>> Opera does the same for textContent.
>>
>> For .src, this obviously means that IE and Opera will then return the
>> directory of the page + "null" where as FF will return the URI to the
>> page.
>>
>> The way IE and Opera do "null" doesn't seem to be just limited to  
>> innerHTML.
>
> Seems to me like they are simply using the ECMAScript ToString
> algorithm, unless I'm mistaken. That's probably a good thing to
> specify for this, too.

I think DOM properties (and sometimes methods and function arguments)  
vary on this. Some use the raw ECMAScript ToString algorithm. Others  
additionally map the null value to the empty string instead of  
"null". Still others map the undefined value to "undefined". Some do  
both. I am pretty sure that for compatibility reasons you can't just  
do the same for each, so we may as well just define and test the  
legacy behavior for each one. Whatever is most common can be the  
default, and others can be marked up in the IDL appropriately.

I think this overlaps with the Web API group's DOM bindings for  
ECMAScript project.

Regards,
Maciej

Received on Monday, 4 June 2007 18:15:33 UTC