btw, if you really want to test for empty string, you would use
if (xxx === "")
On Sat, Nov 14, 2009 at 10:05 AM, Robert Hanson <[email protected]> wrote:
> if (nameSuffix == undefined) is correct. That's what you want. There are
> several locations in Jmol.js where this needs correction. I'm uploading my
> most recent version of Jmol.js so that my corrections are not lost. (Having
> to do with Brian McMahon's frame issue.)
>
> Bob
>
>
> 2009/11/14 Angel Herráez <[email protected]>
>
> On 13 Nov 2009 at 20:28, Jonathan Gutow wrote:
>>
>> > if (! nameSuffix)
>> > nameSuffix = appletCount;
>> > considers nameSuffix = 0 as True.
>>
>> You mean it considers nameSuffix as false when it is zero, hence
>> !nameSuffix as true.
>> That's regular javascript. There is also the issue of "undefined", but
>> seems not to apply in
>> the case of a parameter/argument in a function.
>>
>>
>> > The following change appears to
>> > make it work properly:
>> > if (nameSuffix == null)
>> > nameSuffix = appletCount;
>>
>> Sounds reasonable to me, Jonathan, but I tested and found a glitch:
>> if the parameter is given as an empty string, "", your new code fails.
>> I think it can be achieved using
>>
>> if (nameSuffix==null || ""+nameSuffix=="")
>>
>> that directs to auto-assign
>> - no parameter passed
>> - empty string parameter passed
>> but skips auto-assign for
>> - 0
>> - "0"
>>
>>
>> I'm not sure if the empty string will really reach _jmolApplet() since it
>> will be passed along
>> from user-front functions like jmolApplet(), but I think it's safe to
>> include this test in any
>> case.
>> I had to add the empty quotes in the second half of the test because
>> otherwise zero still
>> evaluates equal to empty string.
>>
>> I think we can modify Jmol.js in this sense.
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
>> 30-Day
>> trial. Simplify your report design, integration and deployment - and focus
>> on
>> what you do best, core application coding. Discover what's new with
>> Crystal Reports now. http://p.sf.net/sfu/bobj-july
>> _______________________________________________
>> Jmol-developers mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/jmol-developers
>>
>
>
>
> --
> Robert M. Hanson
> Professor of Chemistry
> St. Olaf College
> 1520 St. Olaf Ave.
> Northfield, MN 55057
> http://www.stolaf.edu/people/hansonr
> phone: 507-786-3107
>
>
> If nature does not answer first what we want,
> it is better to take what answer we get.
>
> -- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900
>
--
Robert M. Hanson
Professor of Chemistry
St. Olaf College
1520 St. Olaf Ave.
Northfield, MN 55057
http://www.stolaf.edu/people/hansonr
phone: 507-786-3107
If nature does not answer first what we want,
it is better to take what answer we get.
-- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Jmol-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-developers