[Jmol-developers] bug in Jmol2.js - setting the target

2013-09-19 Thread Angel Herráez
Dear Bob, I've found a bug in Jmol2.js -- which otherwise is being a very useful tool! http://chemapps.stolaf.edu/jmol/jsmol/Jmol2.js function jmolSetTarget(targetSuffix) { if (targetSuffix)_jmol.targetSuffix = targetSuffix; return _jmol.target = jmolApplet + _jmol.targetSuffix; } When a

Re: [Jmol-developers] bug in Jmol2.js - setting the target

2013-09-19 Thread Robert Hanson
sure. that should read if (arguments.length 1)... On Thu, Sep 19, 2013 at 4:21 AM, Angel Herráez angel.herr...@uah.es wrote: Dear Bob, I've found a bug in Jmol2.js -- which otherwise is being a very useful tool! http://chemapps.stolaf.edu/jmol/jsmol/Jmol2.js function

Re: [Jmol-developers] bug in Jmol2.js - setting the target

2013-09-19 Thread Robert Hanson
...no, that's not quite right.It may be coming in as undefined. You want: if (targetSuffix == null)... This has confused me for a long time. Doesn't help to have misinformation such as http://saladwithsteve.com/2008/02/javascript-undefined-vs-null.html out there. TOTALLY incorrect advice --

Re: [Jmol-developers] bug in Jmol2.js - setting the target

2013-09-19 Thread Robert Hanson
setting it to this: function jmolSetTarget(targetSuffix) { targetSuffix != null (_jmol.targetSuffix = targetSuffix); return _jmol.target = jmolApplet + _jmol.targetSuffix; } On Thu, Sep 19, 2013 at 7:04 AM, Robert Hanson hans...@stolaf.edu wrote: ...no, that's not quite right.It may be

Re: [Jmol-developers] bug in Jmol2.js - setting the target

2013-09-19 Thread Robert Hanson
full fix is at http://sourceforge.net/p/jsmol/code/269/tree//trunk/jsmoljs/Jmol2.js diff is: http://sourceforge.net/p/jsmol/code/269/tree//trunk/jsmoljs/Jmol2.js?diff=190 I took the opportunity to get rid of references to undefined --- let me know if you think I'm in error there. On Thu,

Re: [Jmol-developers] bug in Jmol2.js - setting the target

2013-09-19 Thread Angel Herráez
I took the opportunity to get rid of references to undefined --- let me know if you think I'm in error there. Sorry, I cannot say. I have no authority on these things. And the syntax confuses me. All I have previously read about these things is to use typeof and to use strict equality,

Re: [Jmol-developers] bug in Jmol2.js - setting the target

2013-09-19 Thread Robert Hanson
Isn't it tricky? My understanding: null == undefined null != 0 null != 0 == 0 == false == false so if (x)... will be false for x = 0, , null, or undefined and if (x==null) will only be true for null or undefined, not 0 or On Thu, Sep 19, 2013 at 8:05 AM, Angel Herráez