Subj : Re: Supressing errors? To : Brian Genisio From : Brendan Eich Date : Mon Feb 02 2004 01:31 pm Brian Genisio wrote: > Sure :) IE v6.0 XP sp2 > > /////////////////////////////////////////////////////// > var myText = document.createTextNode("THIS IS A TEST"); > alert(myText.substringData(window, 4)); > /////////////////////////////////////////////////////// > > The DOMTextData method of substringData takes two integers. If I send > in the object of DOMWindow, it defaults to the integer of 0. The > example given will print "THIS". This is not really a JS engine issue. What DOM spec, if any, governs the behavior shown above? Why should window convert to a string starting with "THIS"? Why should substringData silently convert that to 0? I'm going to go out on a limb and guess that there is no open standard here. > Of course, when I implement the interface for this method, and do a > JS_ValueToInt32, it fails. I can use the default of 0 in this case. > When that the conversion fails, I want to supress the error, because > IE does not show an error either. You don't really want to use a JS API intended for numeric input, then. You should probably check yourself for a non-numeric string literal. Isn't the literal in fact supposed to be a non-negative integer literal? That's easy to check for in your own code. > Like I mentioned earlier, I can do other types of checks, and I > already override the error handler, so I have solutions for this, but > I guess I was wondering if there was an API way to surpress an error > type... Or, it is possible that I am doing something wrong still :) Is reverse-engineering the IE DOM wrong? Some would say so ;-). Don't encourage non-standard quirks if you can help it. What's all this for, anyway? /be .