W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2006

Re: appendChild exception missing from standard

From: Hallvord R. M. Steen <hallvord@opera.com>
Date: Mon, 11 Sep 2006 19:04:56 +0200
To: "Ray Whitmer" <ray@xmission.com>
Cc: www-dom@w3.org
Message-ID: <op.tfp4eigsa3v5gv@hr-opera>

On Mon, 11 Sep 2006 11:39:38 +0200, Ray Whitmer <ray@xmission.com> wrote:

> Have you read section 1.4 in the DOM specification level 3

Hi Ray,
not recently I guess, thanks for pointing me in the right direction..

> "Implementations should raise other exceptions under other  
> circumstances.  For example, implementations should raise an  
> implementation-dependent exception if a null argument is passed when a  
> null was not expected"
>
> There are, clearly, any number of things you could pass to any of the  
> functions for which the results are not completely defined.  The  
> specification does not define behavior for each possible illegal input.

Understood. However, I have recently seen scripts where the authors depend  
on this behaviour (exceptions being thrown if null or string is passed to  
appendChild). Keeping this "implementation specific" means less  
interoperability because some implementations will violate the  
expectations of those authors. Hence I think it would be a good idea to  
state explicitly what should happen in these cases.

> I suggest more careful reading of the specification.  Talk about what the
> specification says on the topic, not just that you were surprised by it  
> now that you have someone worrying about it.  Those who attended the  
> many meetings where these things were discussed did not completely miss  
> the issue.  There were reasons why these particular things were kept  
> implementation-dependent.  I am sorry it was not convenient for you to  
> raise the issue during the many years when active participation and  
> feedback in the group was being solicited, so that you could have some  
> ownership in the current set of standards.

I suppose that what I personally would have contributed during those years  
would have caused the rest of the table to talk about September and  
newbies :-) . If I may come late to the party I hope that my comments  
today might have some value.

>> http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-184E7107
>> doesn't say what exception appendChild should throw on invalid input
>> (such as null or a string). A while ago we at Opera realised that  
>> pretty much
>> everyone else throws an exception that isn't in the spec, (learnt the  
>> hard way since
>> not doing so broke Google Reader..) so I suggest the spec is updated to  
>> cover exceptions due to arguments that are not nodes or document  
>> fragments.
>>
>> (This is also relevant for other DOM functions like replaceChild)


-- 
Hallvord R. M. Steen
Core QA JavaScript tester, Opera Software
http://www.opera.com/
Opera - simply the best Internet experience
Received on Monday, 11 September 2006 17:01:44 GMT

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