Announcing MooTools More 1.3

Written by Arian Stolwijk on 29 October 2010 – Posted under all, releases

We hereby announce the immediate availability of MooTools More 1.3.0.1. We have updated all of MooTools More’s code to work with the recently released Core 1.3 without 1.2 compatibility. Besides the API update, 1.3 improves stability and introduces some awesome new features.

Awesome new features? What awesome new features?

Events.Pseudos, wait, this isn’t happening!

MooTools Core 1.3 includes our new selector engine Slick. One of Slick’s components is Slick.Parser. Slick.Parser parses a CSS selector to an object representation of the selector, called a "Slick object". Since our Event Delegation already uses such a CSS style notation for defining events, i.e. click:relay, we decided to take this to the next level: Events.Pseudos and Element.Event.Pseudos. I’ll show you an example of how it works:

document.addEvent('keydown:keys(shift+c)', function(){
    alert('You pressed the shift and c keys!');
});

We append an event pseudo, :keys to the existing event name, to get custom events. This doesn’t only work for Element events, but for the Class event system, the Events mixin, as well. Currently we’ve implemented the pseudo events :once for both Events as Element.Event and :keys and :relay for Element.Event.

Locale, localizzazione, Lokalisierung, localización, локализация

For 1.3 we’ve rewritten MooTools.lang to Locale. It’s now more powerful and has a much better API. A big thanks to our community as well! A lot of people helped us improve translations for their native languages.

A simple example looks like:

Locale.use('nl-NL');
Locale.get('Ping.stop'); // w00fz, kun je alsjeblieft stoppen met pingen

However, the real cpower of the new Locale is its inheritance abilities. For example, if you take Portuguese, it’s used in several countries around the world, like in Brazil. Brazilian Portuguese is slightly different, but has many similarities. Now instead of recreating a whole Locale Set file, you can now inherit the Portuguese translations and overwrite only the values that are different.

Locale.define('pt-BR', 'ping', {
    // ... key-value pairs
}).inherit('pt-PT');

Another awesome thing is the new Locale.Set.From function which right now allows you to create Locale Sets from a JSON string. The plan is to extend this in the future to support other data formats. This function will make it easier to share translations between server and client side: you can do a Request to your server, and pass the responseText to Locale.Set.From right away.

Number.format

Because Localization is more than just converting strings to other languages, we added Number.Format to MooTools More. Just like our Date.format works for dates, Number.format lets you format numbers in various formats.

(101).formatCurrency(); // € 101,00

HtmlTable

HtmlTable has received a lot of attention. Its API is a little more useful now, but there are numerous features added including the ability to select multiple rows with shift and ctrl, keyboard support, and more robust sortability controls.

Notable changes in 1.3

  • A total of 105 tickets closed for 1.3.0.1 (first 65 tickets here, 28 tickets here, and another 12 here)
  • Hash has been deprecated in 1.3 Core. But fear not! More 1.3 provides Hash now.
  • Hash.Extras are now also available as Object.Extras
  • Event Delegation now supports the mouseenter and mouseleave events
  • Log.js has been removed. Use this or this or just console.log and friends.
  • Like myElement.get(‘tween’, options) Fx Classes in More don’t support the second argument of Element.get anymore either. You can find more information in the Update Wiki Page
  • EcmaScript 5 array methods Array:reduce and Array:reduceRight are added to Array.Extras
  • Date.parse now follows the UNIX specification of strftime.
  • Full changelog for 1.3 (Note that changes that we also applied for 1.2.5.1 will be listed under 1.2.5.1)

Testing

Like Core and Slick we have moved More to use our new Specs Runner. We tried to cover as much as possible in the Specs. However, More contains a lot of UI components that are very difficult to test with the Specs. Therefore we have new UI tests, which are basically HTML pages with JavaScript and CSS. You can run the tests with mootools-test-runner (Python + Django) or mootools-ui-runner (PHP)

MooTools 1.2.5.1

Together with this 1.3 release we also release MooTools More 1.2.5.1, which is an update for the 1.2 branch for the people who are not (yet) able to upgrade to 1.3. It has the improved stability of 1.3 and some new features.

Notable changes in 1.2.5.1

  • There are 65 tickets closed since the previous 1.2.4.4. release.
  • All optimizations and updates done to existing code in 1.3.0.1 are applied on the 1.2.5.1 branch as well
  • Depender.js is no more, use Packager or Depender on the server side.
  • Full changelog for 1.2.5.1

Get It NAOW, with a smile!

comments powered byDisqus