Created
September 26, 2010 19:21
-
-
Save cpojer/598232 to your computer and use it in GitHub Desktop.
This file contains 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
// 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); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment