mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Made some minor formatting changes to the access function.
This commit is contained in:
parent
80913618b0
commit
ede2f2c4f7
11
src/core.js
11
src/core.js
@ -657,7 +657,7 @@ function evalScript( i, elem ) {
|
|||||||
// Mutifunctional method to get and set values to a collection
|
// Mutifunctional method to get and set values to a collection
|
||||||
// The value/s can be optionally by executed if its a function
|
// The value/s can be optionally by executed if its a function
|
||||||
function access( elems, key, value, exec, fn ) {
|
function access( elems, key, value, exec, fn ) {
|
||||||
var l = elems.length;
|
var length = elems.length;
|
||||||
|
|
||||||
// Setting many attributes
|
// Setting many attributes
|
||||||
if ( typeof key === "object" ) {
|
if ( typeof key === "object" ) {
|
||||||
@ -672,16 +672,15 @@ function access( elems, key, value, exec, fn ) {
|
|||||||
// Optionally, function values get executed if exec is true
|
// Optionally, function values get executed if exec is true
|
||||||
exec = exec && jQuery.isFunction(value);
|
exec = exec && jQuery.isFunction(value);
|
||||||
|
|
||||||
for (var i = 0; i < l; i++) {
|
for ( var i = 0; i < length; i++ ) {
|
||||||
var elem = elems[i],
|
fn( elems[i], key, exec ? value.call( elems[i], i ) : value );
|
||||||
val = exec ? value.call(elem, i) : value;
|
|
||||||
fn(elem, key, val);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return elems;
|
return elems;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Getting an attribute
|
// Getting an attribute
|
||||||
return l ? fn(elems[0], key) : null;
|
return length ? fn( elems[0], key ) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function now() {
|
function now() {
|
||||||
|
Loading…
Reference in New Issue
Block a user