Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
// 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
// from 1.2
set: function(prop, value){
switch (typeOf(prop)){
case 'object':
for (var p in prop) this.set(p, prop[p]);
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 wrap;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment