ana-beltran / simile-widgets

Automatically exported from code.google.com/p/simile-widgets
0 stars 0 forks source link

bug with 'or' function #404

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
'or' always returns false.

This happens because the return variable r is tested as part of the for loop, 
and since r is initialized as false, the loop never runs.

The solution is to replace r with !r.

The current code is:

***

Exhibit.Functions["or"] = {
    f: function(args) {
        var r = false;
        for (var i = 0; r && i < args.length; i++) {
            r = r || args[i].contains(true);
        }
        return new Exhibit.Expression._Collection([ r ], "boolean");
    }
};

***

A corrected version:

***

Exhibit.Functions["or"] = {
    f: function(args) {
        var r = false;
        for (var i = 0; !r && i < args.length; i++) {
            r = r || args[i].contains(true);
        }
        return new Exhibit.Expression._Collection([ r ], "boolean");
    }
};

Original issue reported on code.google.com by benitoel...@gmail.com on 16 Oct 2010 at 7:10

GoogleCodeExporter commented 8 years ago
This bug is already fixed in the development version of Exhibit (revision 2011).

Original comment by m.d.na...@hetnet.nl on 27 Oct 2010 at 8:15

GoogleCodeExporter commented 8 years ago

Original comment by ryan...@csail.mit.edu on 23 Jun 2011 at 9:24

GoogleCodeExporter commented 8 years ago
I have a counter down script of a particular it works fine on all browser but 
not work on IE8 i have attached the file please check this and resolve the issue

Original comment by azeem.ak...@gmail.com on 6 Jul 2011 at 9:50

Attachments: