Created
June 7, 2009 06:43
-
-
Save benatkin/125199 to your computer and use it in GitHub Desktop.
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
| (function($) { | |
| $(document).ready(function() { | |
| // adds support for setting multiple css attributes with one call to css() | |
| // Example: $('.foo').css('background', 'black', 'color', 'white') | |
| $.fn.css_orig = $.fn.css; | |
| $.fn.css = function() { | |
| var sel = this; | |
| if (arguments.length > 2) { | |
| for (var i = 0; i < arguments.length; i += 2) { | |
| sel = sel.css_orig(arguments[i], arguments[i + 1]); | |
| } | |
| return sel; | |
| } else { | |
| return sel.css_orig.apply(sel, arguments); | |
| } | |
| }; | |
| // adds support for setting multiple DOM attributes with one call to attr() | |
| // Example: $('#foo').attr('name', 'foo', 'class', 'foo') | |
| $.fn.attr_orig = $.fn.attr; | |
| $.fn.attr = function() { | |
| var sel = this; | |
| if (arguments.length > 2) { | |
| for (var i = 0; i < arguments.length; i += 2) { | |
| sel = sel.attr_orig(arguments[i], arguments[i + 1]); | |
| } | |
| return sel; | |
| } else { | |
| return sel.attr_orig.apply(sel, arguments); | |
| } | |
| }; | |
| }); | |
| })(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment