Element.js (original) (raw)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})
| // Upgrade from MooTools Core 1.2 to MooTools Core 1.3 |
|---|
| // |
| // Brings compatibility for Element.set and Element.get with multipe arguments. |
| // Use at your own risk; if cou can - fix your code and do not use this script. |
| // -- @cpojer |
| (function(){ |
| Element.implement({ |
| // from 1.2 |
| set: function(prop, value){ |
| switch (typeOf(prop)){ |
| case 'object': |
| for (var p in prop) this.set(p, prop[p]); |
| break; |
| case 'string': |
| var property = Element.Properties[prop]; |
| (property && property.set) ? property.set.apply(this, Array.slice(arguments, 1)) : this.setProperty(prop, value); |
| } |
| return this; |
| }, |
| get: function(prop){ |
| var property = Element.Properties[prop]; |
| return (property && property.get) ? property.get.apply(this, Array.slice(arguments, 1)) : this.getProperty(prop); |
| } |
| }); |
| var props = Element.Properties; |
| var wrap = function(prop){ |
| if (!props[prop]) return wrap; |
| var getter = props[prop].get; |
| props[prop].get = function(options){ |
| if (options) this.set(prop, options); |
| return getter.call(this); |
| }; |
| return wrap; |
| }; |
| wrap('tween')('morph')('load')('send'); |
| })(Element.Properties); |