The new version is 1.0.2:
http://base2.googlecode.com/svn/version/1.0.2/
This fixes an issue in Firefox 4. Mozilla changed the way that nulls are
enumerated by Array.forEach and that broke base2 pretty badly.
The good news is that base2 has proven to be pretty robust. This is only
the second patch that I've had to release. Both patches have been
because of changes to JavaScript implementations (not DOM related).
Version 2.0 of base2 is now feature complete. I am currently preparing a
preview release. Version 2.0 is not compatible with version 1.0. The
APIs are largely the same but you will have to do some refactoring if
you want to upgrade.
-dean
It would be much nicer if the sand didn't keep shifting!
I get the feeling that this change was made by Mozilla to provide ES5
compliance. The real annoyance is that ES5 has defined behaviour that is
contrary to all current JavaScript implementations.
> What I personally miss is what the exact change is.
> You created a new folder under the version root folder, but the change
> set does not include the changed base files.
> (of course i could fetch both versions to a local disc, but with the
> google tooling on the google code pages i am lost. Yes, you may call
> me lazy).
I changed the following (line 1164 in /version/1.0.1/base2.js):
// Remove methods that are already implemented.
for (var name in INative) {
if (name != "prototype" && Native[name]) {
INative[name] = Native[name];
delete INative.prototype[name];
}
Native2[name] = INative[name];
}
to this:
// Remove methods that are already implemented.
for (var name in INative) {
if (name != "prototype" && Native[name]) {
delete INative.prototype[name];
}
Native2[name] = INative[name];
}
I'm getting rid of the JavaScript package in version 2.0 anyway. :)
-dean
The functionality is still there.
To get the functionality of Date2, you can now do this:
base2.require("Date", function() {
var Date = base2.Date;
alert(Date.now());
alert(new Date.toISOString());
alert(Date.parse("2001-01-01"));
});
If the native Date is ISO compliant then that object is used without
loading the patch. This avoids loading code that is not used on most
browsers.
What functions of Array2 are you using that you will miss? All of the
Enumerable methods are still available in the Enumerable object and in
base2's namespace:
base2.exec(function(namespace) {
eval(namespace);
var numbers = [1,2,4];
var squares = map(numbers, function(value) {
return value * value;
});
});
I'd consider providing a loader for Array that is similar to Date. But
it does pose a slightly different problem which I am happy to elaborate on.
-dean
Funny you should mention indexOf() as I just added it to base2.lang.
It's been in and out for a while and I've finally decide that it should
be in the core library.
contains() can be easily derived from indexOf() so you won't miss that. :)
-dean