Converting Mootools 1.11 to Mootools 1.2

Converting Mootools 1.11 to Mootools 1.2


We will know how to convert:
  • Element
  • Array
  • Function
  • Class
  • Ajax
  • Cookie
  • Json
  • Extending
  • Effects
  • Plugins

Element

              1.11                  =>                1.2
============================================================================
el.getTag()                         |  el.get('tag')
el.setHTML(string|array)            |  el.set('html', string|array)
el.getText()                        |  el.get('text')
el.setText(string)                  |  el.set('text', string)
el.setOpacity(number)               |  el.set('opacity', number)
el.remove()                         |  el.dispose()
el.replaceWith(element)             |  element.replaces(el) // note: inverts
                                    |    positions of element and el
el.effects(obj)                     |  new Fx.Morph(el, obj)
$E(selector)                        |  document.getElement(selector)
$ES(selector)                       |  document.getElements(selector)

Array

              1.11                  =>                1.2
============================================================================
[].copy(start, length)              |  removed in favour of $A and [].slice  
[].remove(item)                     |  [].erase(item)
[].merge([])                        |  [].combine([])

Function

               1.11                    =>                1.2
============================================================================
fn.bindAsEventListener(object, array)  |  removed, since every addEvent
                                       |    callback has an event
Function.empty/Class.empty             |  $empty

Class

              1.11                  =>                1.2
============================================================================
Missing …

Ajax

              1.11                  =>                1.2
============================================================================
$('myform').send([options]);
    => $('myform').set('send',[options]).send();
new XHR({[options]}).send(url[, datastring]);
    =>  new Request({'url':url[, options]}).send([datastring]);

Cookie

              1.11                  =>                1.2
============================================================================
Cookie.set(key, value[, options]);  |  Cookie.write(key, value[, options]);
Cookie.get(key)                     |  Cookie.read(key)
Cookie.remove(cookie[, options]);   |  Cookie.dispose(cookie[, options]);

Json

              1.11                  =>                1.2
============================================================================
Json.evaluate(string)               |   JSON.decode(string, secure)
Json.toString(mixed)                |   JSON.encode(mixed)

Extending

              1.11                  =>                1.2
============================================================================
Element.extend(object)/String.extend(object)
  =>  String.implement(object)/String.implement(string, function)
window.extend(object)/document.extend(object)
  =>  Window.implement(object)/Document.implement(string, function)

Effects

              1.11                  =>                1.2
============================================================================
new Fx.Style(element, property [, options]).start([from,] to);          
    =>  new Fx.Tween(element [, options]).start([property], from[, to]);
$(element).effect(property [, options]).start([startvalue,] endvalue);  
    =>  $(element).get(property [, options]).start(startvalue[, endvalue]);

Plugins

              1.11                  =>                1.2
============================================================================
new Drag.Base(el[, options]);       |  new Drag(el[, options]);

Pin It on Pinterest

Share This