Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
jquery
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
夏彬
jquery
Commits
9e1a955a
Commit
9e1a955a
authored
Sep 11, 2009
by
Ariel Flesler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jquery core: commenting the new access function.
parent
d1285504
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
core.js
src/core.js
+6
-0
No files found.
src/core.js
View file @
9e1a955a
...
@@ -553,9 +553,12 @@ function evalScript( i, elem ) {
...
@@ -553,9 +553,12 @@ function evalScript( i, elem ) {
}
}
}
}
// Mutifunctional method to get and set values to a collection
// 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
l
=
elems
.
length
;
// Setting many attributes
if
(
typeof
key
===
"object"
)
{
if
(
typeof
key
===
"object"
)
{
for
(
var
k
in
key
)
{
for
(
var
k
in
key
)
{
access
(
elems
,
k
,
key
[
k
],
exec
,
fn
);
access
(
elems
,
k
,
key
[
k
],
exec
,
fn
);
...
@@ -563,7 +566,9 @@ function access( elems, key, value, exec, fn ) {
...
@@ -563,7 +566,9 @@ function access( elems, key, value, exec, fn ) {
return
elems
;
return
elems
;
}
}
// Setting one attribute
if
(
value
!==
undefined
)
{
if
(
value
!==
undefined
)
{
// 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
<
l
;
i
++
)
{
...
@@ -574,6 +579,7 @@ function access( elems, key, value, exec, fn ) {
...
@@ -574,6 +579,7 @@ function access( elems, key, value, exec, fn ) {
return
elems
;
return
elems
;
}
}
// Getting an attribute
return
l
?
fn
(
elems
[
0
],
key
)
:
null
;
return
l
?
fn
(
elems
[
0
],
key
)
:
null
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment