- From: Garrett Smith <dhtmlkitchen@gmail.com>
- Date: Tue, 26 Aug 2008 17:22:59 -0700
- To: "Jonas Sicking" <jonas@sicking.cc>
- Cc: "Boris Zbarsky" <bzbarsky@mit.edu>, "Web Applications Working Group WG" <public-webapps@w3.org>
On Tue, Aug 26, 2008 at 4:47 PM, Jonas Sicking <jonas@sicking.cc> wrote: >>> One last time, the facts: >>> >>> 1) There are DOM methods that accept DOMString arguments or return >>> DOMString values. >> >> Fact. > > Sounds like you agree here. > It's easily provable. >>> 2) In general, such methods need to be able to tell apart null and all >>> string values (including "" and "null"). >> >> They need to determine value type so that they can either throw or >> handle. null, 0, undefined, new String('x'), are all not strings. > > Sounds like you agree here too? EcmaScript is runtime. No compiler check for createElement(undefined, 0, 1, 3). > >>> 3) The behavior of null is almost always either that of "" or that of >>> "null". Which one depends on the exact DOM method. >> >> That is false. null has no behavior. Methods have behavior. For >> example, EcmaScript's internal ToString has a behavior of converting >> null to "null". That is a behavior. > > You aren't actually answering Boris question, but rather point out a > grammatical error in the question. I know I sounds pedantic, but it is for a reason. There is a desire to associate null with either "null" or "". It seems reasonable to allow the language to handle such conversion. An alternative would be to provide a global serialization scheme in IDL. > So let me repeat the question with > the grammatical error fixed. Please do excuse any other grammar errors I > introduce as English is a second language to me. > > 3) The behavior of the function when null is passed as value for an > argument is almost always either that of "" or that of "null". > Which one depends on the exact DOM method. > > Do you agree with this? > No, I do not agree. If the parameter type is domstring, and null is not allowed, and the caller passes null, then the current behavior is implementation-dependent. I did not agree ever that "" should be used when null is passed as a value to an object that expects a string (or dom method that expects a domstring). I believe that in the following:- el.textContent = null; - with the options:- a) raise exception b) textContent is set to "null" c) textContent is set to "" Option (c) is wrong. Option (b) would be marginally useful in a few cases Option (a) would be helpful in some cases (finding bugs) Your English is better than most native speakers. I can't remember ever getting confused by your writing. My previous, previous message, in response to Andrew Oakley, contains more in-depth on the subject. Garrett > / Jonas >
Received on Wednesday, 27 August 2008 00:23:34 UTC