| @@ 825-850 (lines=26) @@ | ||
| 822 | ||
| 823 | // Mutifunctional method to get and set values to a collection |
|
| 824 | // The value/s can optionally be executed if it's a function |
|
| 825 | access: function( elems, key, value, exec, fn, pass ) { |
|
| 826 | var length = elems.length; |
|
| 827 | ||
| 828 | // Setting many attributes |
|
| 829 | if ( typeof key === "object" ) { |
|
| 830 | for ( var k in key ) { |
|
| 831 | jQuery.access( elems, k, key[k], exec, fn, value ); |
|
| 832 | } |
|
| 833 | return elems; |
|
| 834 | } |
|
| 835 | ||
| 836 | // Setting one attribute |
|
| 837 | if ( value !== undefined ) { |
|
| 838 | // Optionally, function values get executed if exec is true |
|
| 839 | exec = !pass && exec && jQuery.isFunction(value); |
|
| 840 | ||
| 841 | for ( var i = 0; i < length; i++ ) { |
|
| 842 | fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); |
|
| 843 | } |
|
| 844 | ||
| 845 | return elems; |
|
| 846 | } |
|
| 847 | ||
| 848 | // Getting an attribute |
|
| 849 | return length ? fn( elems[0], key ) : undefined; |
|
| 850 | }, |
|
| 851 | ||
| 852 | now: function() { |
|
| 853 | return ( new Date() ).getTime(); |
|
| @@ 785-810 (lines=26) @@ | ||
| 782 | ||
| 783 | // Mutifunctional method to get and set values to a collection |
|
| 784 | // The value/s can be optionally by executed if its a function |
|
| 785 | access: function( elems, key, value, exec, fn, pass ) { |
|
| 786 | var length = elems.length; |
|
| 787 | ||
| 788 | // Setting many attributes |
|
| 789 | if ( typeof key === "object" ) { |
|
| 790 | for ( var k in key ) { |
|
| 791 | jQuery.access( elems, k, key[k], exec, fn, value ); |
|
| 792 | } |
|
| 793 | return elems; |
|
| 794 | } |
|
| 795 | ||
| 796 | // Setting one attribute |
|
| 797 | if ( value !== undefined ) { |
|
| 798 | // Optionally, function values get executed if exec is true |
|
| 799 | exec = !pass && exec && jQuery.isFunction(value); |
|
| 800 | ||
| 801 | for ( var i = 0; i < length; i++ ) { |
|
| 802 | fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); |
|
| 803 | } |
|
| 804 | ||
| 805 | return elems; |
|
| 806 | } |
|
| 807 | ||
| 808 | // Getting an attribute |
|
| 809 | return length ? fn( elems[0], key ) : undefined; |
|
| 810 | }, |
|
| 811 | ||
| 812 | now: function() { |
|
| 813 | return (new Date()).getTime(); |
|