
24/02/2011

Aucun commentaire

11 visiteurs aiment
Le framework JavaScript mooTools version 1.3 est désormais distribué en lieu et place de la version 1.2.5... Qu'est-ce que cela change niveau programmation ? Voici un petit récapitulatif des grands changements à opérer sur les programmes basés sur la 1.2.x.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 replacementNative => 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.BrowserEngine 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.ieBrowser.Engine.gecko => Browser.firefoxBrowser.Engine.webkit => Browser.safari or Browser.chromeBrowser.Engine.presto => Browser.operaBrowser.Platform.ipod => Browser.Platform.ios$exec => Browser.execArray$pick => Array.pick or [a, b, c].pick()Array.extend => Array.appendFunction$try => Function.attemptmyFn.run(args, bind) => myFn.apply(bind, Array.from(args));myFn.create => Use the according functions like .pass, .bind, .delay, .periodicalmyFn.bindWithEvent => deprecatedmyFn.bind(this, [arg1, arg2, arg3]) => myFn.bind(this, arg1, arg2, arg3) OR myFn.pass([arg1, arg2, arg3], this)Elementelement.injectInside, .injectBefore, .injectAfter, .injectBottom,
.injectTop => element.inject(context, where); // where = inside,
bottom, …element.grabTop, … => element.grab(context, where) // see aboveelement.hasChild(item) => element.contains(item) && item != element$$ now only accepts a single selector, an array or arguments of elementsSelectors.Pseudo => Slick.definePseudo(name, fn)Source : github.com/mootools - Pour aller plus loin...