Upgrade from 1.2 to 1.3

This is a list of the API changes made from 1.2 to 1.3. It allows you to drop the compatibility layer mostly by doing search and replace. If you just want to update to MooTools Core 1.3 with your existing code, see Update from 1.2 to 1.3.

Core
$chk(value) => (value != null)
$A(item) => Array.from(item) // Note: Array.from does not always return a new array but just ensures that the return value is an array.
$splat => Array.from
$clear => use the native clearTimeout when using fn.delay, use clearInterval when using fn.periodical.
$defined => (value != null)
$each => use Array.each for arrays, Object.each for objects
$empty => No replacement, use function(){}
$extend(source, extended) => Object.append(source, extended)
$merge(a, b) => Object.merge({}, a, b)
$mixin(a, b) => Object.merge(a, b)
$lambda => Function.from
$random => Number.random
$time => Date.now
$type => typeOf // Note: returns a string 'null' on empty objects as opposed to "false" in 1.2
$unlink => Array.clone or Object.clone
$arguments => No replacement
Native => Type (see Core.js)
Array.type / String.type / Number.type / … => Type.isArray / Type.isString / Type.isNumber / …
Hash and $H were deprecated and moved from Core to More. Use plain objects instead of Hash. You can find methods to manipulate objects on Object. You can find all 1.2 functionality of Hash in MooTools More 1.3.
Browser
Engine detection was changed in favor of user-agent detection. Browser.Engine was deprecated and according properties on the Browser object were added:

Browser.Engine.trident => Browser.ie
Browser.Engine.gecko => Browser.firefox
Browser.Engine.webkit => Browser.safari or Browser.chrome
Browser.Engine.presto => Browser.opera
Browser.Platform.ipod => Browser.Platform.ios
$exec => Browser.exec
Array
$pick => Array.pick or [a, b, c].pick()
Array.extend => Array.append
Function
$try => Function.attempt
myFn.run(args, bind) => myFn.apply(bind, Array.from(args));
myFn.create => Use the according functions like .pass, .bind, .delay, .periodical
myFn.bindWithEvent => deprecated
myFn.bind(this, [arg1, arg2, arg3]) => myFn.bind(this, arg1, arg2, arg3) OR myFn.pass([arg1, arg2, arg3], this)
Element
element.injectInside, .injectBefore, .injectAfter, .injectBottom, .injectTop => element.inject(context, where); // where = inside, bottom, …
element.grabTop, … => element.grab(context, where) // see above
element.hasChild(item) => item !== element && element.contains(item)
$$ now only accepts a single selector, an array or arguments of elements
Selectors.Pseudo => Slick.definePseudo(name, fn)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值