Today after many months of work, the latest version of MooTools Core and the shiny new MooTools More have launched. If you haven’t read up on that, you best get on it. But, you ask, what about all the goodies on Clientcide? Obviously you’ll want to upgrade to the latest MooTools (it’s pretty painless – no big breaking changes). Looking at the new MooTools More you’ll see a lot of familiar classes – FormValidator, OverText, Class.Binds, etc. Well, while the changes to Core don’t require you to do anything to upgrade, the changes from Clientcide to More aren’t so simple.
Core and More
There aren’t a ton of new features in 1.2.2; mostly bug fixes and whatnot, but I will say that Class.js got an overhaul and has a whole new kind of awesome that most people probably won’t notice. It’s a humble awesomeness, if that’s possible.
And then there’s MooTools More. As I wrote back in the beginning of February, the new MooTools More features a ton of new functionality, much of it from the Clientcide libraries run through the meat grinder of the MooTools dev team making it much cleaner and more consistent than I ever did. This also lead to a lot of changes.
The Clientcide Libs
A lot of things have changed, actually. Here’s the high-level list:
- MultipleOpenAccordion
- now only takes options
- openAll defaults to false
- CiUI (iPhone code)
- Browser.Extras
- methods now either part of URI class or stand alone string methods
- Browser.qs deprecated entirely; use new URI().getData()
- Class.Binds
- mutator is now upper case (Binds instead of binds)
- Class.Refactor
- no longer an instance method (you can’d to Foo.refactor({props}) – you must do Foo = Class.refactor(Foo, props))
- Element.Forms
- deprecated Element property inputValue; too confusing!
- Element.Position
-
Element.setPosition is now Element.position and vice versa. I.e. Element.position (which in MooTools 1.2.1 took an object with x/y coords for top/left) is now Element.setPosition. Element.setPosition (which in the previous Clientcide libs took options for relative positioning) is now Element.position.
- Element.Shortcuts
-
Element.isVisible is Element.isDisplayed
- IframeShim
- options:zindex renamed to zIndex
- OverText
- no longer takes a collection of inputs.
- .showTxt > .show, .hideTxt > .hide
- .hide and .show no longer take the element and ‘focus’ arguments.
- .repositionAll is gone; .repositionOverTxt is now just .reposition; it does not take an argument
- String.Extras
- findAllEmails gone, too specific
- Date
- deprecated String.zeroise
- JsonP
- renamed to Request.JSONP
- constructor/send/prepareUrl take options hash, no longer an url directly (like Request)
- user can change options on the fly when calling send() with a new hash, reusing the object
- added check method. support for link: ignore, cancel, chain (like Request)
- added success, request and cancel events
- data can be a hash or string now (like Request)
- queryString option gone
- makeUrl logic now moved to new getScript(), which directly returns the script
- changed how it essentially works. instead of storing the object reference, we store a new function every time a request is made, that keeps a reference of the script element and the object instance.
- abortAfter and timeout gone. there’s now a single timeout for retries and for when retries run out.
- globalFunction gone, deemed useless
- Request.Queue
- event names all renamed; onRequestStart >> onRequest, onRequestSuccess >> onSuccess, etc
- StickyWin
-
StickyWin.Fx is now just StickyWin.
- MultipleOpenAccordion
- Now only takes an options argument; container argument is deprecated.
Don’t Freak Out
The good news is that I’ve authored compatibility for all of these things. In theory you should be able to download the 1.2.2 core, the new More, the latest Clientcide and include the compatibility scripts and go about your business. At some point you’re going to want to refactor things with the changes above in mind so that you can remove the compat files of course, but in theory you should be ok (and if not, file a bug).
There’s three changes that I can’t really write a compatibility file for
- FormValidator
- The base FormValidator class no longer injects advice into the document. You must use FormValidator.Inline for this behavior.
- Class.refactor
- this.parent is no longer useful; you must use this.previous
- String.cleanQueryString
- if you specify a custom message its arguments are now key, value (before it was set where set was “key=value”).
FormValidator now has been split into FormValidator and FormValidator.Inline. FormValidator just validates forms but doesn’t really do anything; it just fires events when inputs and forms are validated. FormValidator.Inline is what the Clientcide FormValidator used to be with the advice injected into the document after each input. So if you’re using FormValidator, you’ll need to do a quick search and replace for “new FormValidator” and replace it with “new FormValidator.Inline” and you should be fine.
Class.refactor no longer has access to this.parent, only this.previous. You’ll need to find these references and change them.
String.cleanQueryString, which accepts an optional function, now passes different arguments to that function.
Hopefully these 3 changes won’t represent a huge burden for you.
Clientcide Organizational Changes
I’m moving the libs here over to github. This should make it easier for others to get involved and fix bugs and now that MooTools is on git I want to consolidate my workflow. This means that, as of today, the google code svn is basically no longer in use. I’ll be updating it shortly to reflect this.
I’m also moving the ticketing for Clientcide. I was going to move it to lighthouse but now I’m thinking I’ll use the new issues system that’s on github. It’s not very robust, but it should do for my purposes. I’ll leave the open tickets that are on google there for now and close them out as I can.
Feedback on all this stuff is, as always, greatly appreciated.