Created
February 22, 2011 10:20
-
-
Save assertchris/838470 to your computer and use it in GitHub Desktop.
Modified Options mutator methods (MooTools Class.Extras)
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
Orignal: | |
setOptions: function(){ | |
var options = this.options = Object.merge.apply(null, [{}, this.options].append(arguments)); | |
if (!this.addEvent) return this; | |
for (var option in options){ | |
if (typeOf(options[option]) != 'function' || !(/^on[A-Z]/).test(option)) continue; | |
this.addEvent(option, options[option]); | |
delete options[option]; | |
} | |
return this; | |
} | |
New: | |
setOptions: function(){ | |
var options = this.options = Object.merge.apply(null, [{}, this.options].append(arguments)); | |
if (!this.addEvent) return this; | |
if (options.events){ | |
for (var option in options.events){ | |
if (typeOf(options.events[option]) != 'function') continue; | |
this.addEvent(option, options.events[option]); | |
delete options.events[option]; | |
} | |
} | |
return this; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment