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
5f4f247d
Commit
5f4f247d
authored
Dec 29, 2006
by
John Resig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added in some changes to class handling and some docs for jQuery.nth().
parent
666cc900
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
22 deletions
+27
-22
jquery.js
src/jquery/jquery.js
+27
-22
No files found.
src/jquery/jquery.js
View file @
5f4f247d
...
...
@@ -1235,28 +1235,21 @@ jQuery.extend({
},
className
:
{
add
:
function
(
o
,
c
){
if
(
jQuery
.
className
.
has
(
o
,
c
))
return
;
o
.
className
+=
(
o
.
className
?
" "
:
""
)
+
c
;
add
:
function
(
elem
,
c
){
if
(
jQuery
.
className
.
has
(
elem
,
c
)
)
return
;
elem
.
className
+=
(
elem
.
className
?
" "
:
""
)
+
c
;
},
remove
:
function
(
o
,
c
){
if
(
!
c
)
{
o
.
className
=
""
;
}
else
{
var
classes
=
o
.
className
.
split
(
" "
);
for
(
var
i
=
0
;
i
<
classes
.
length
;
i
++
)
{
if
(
classes
[
i
]
==
c
)
{
classes
.
splice
(
i
,
1
);
break
;
}
}
o
.
className
=
classes
.
join
(
' '
);
}
remove
:
function
(
elem
,
c
){
elem
.
className
=
c
?
jQuery
.
grep
(
elem
.
className
.
split
(
/
\s
+/
),
function
(
cur
){
return
jQuery
.
className
.
has
(
c
,
cur
);
}).
join
(
' '
)
:
""
;
},
has
:
function
(
e
,
a
)
{
if
(
e
.
className
!=
undefined
)
e
=
e
.
className
;
return
new
RegExp
(
"(^|
\\
s)"
+
a
+
"(
\\
s|$)"
).
test
(
e
);
has
:
function
(
elem
,
c
)
{
if
(
e
lem
.
className
!=
undefined
)
e
lem
=
elem
.
className
;
return
new
RegExp
(
"(^|
\\
s)"
+
c
+
"(
\\
s|$)"
).
test
(
elem
);
}
},
...
...
@@ -1407,6 +1400,18 @@ jQuery.extend({
return
r
;
},
/**
* A handy, and fast, way to traverse in a particular direction and find
* a specific element.
*
* @private
* @name $.nth
* @type DOMElement
* @param DOMElement cur The element to search from.
* @param Number|String num The Nth result to match. Can be a number or a string (like 'even' or 'odd').
* @param String dir The direction to move in (pass in something like 'previousSibling' or 'nextSibling').
* @cat DOM/Traversing
*/
nth
:
function
(
cur
,
result
,
dir
){
result
=
result
||
1
;
var
num
=
0
;
...
...
@@ -1463,7 +1468,7 @@ jQuery.extend({
submit
:
"a.type=='submit'"
,
image
:
"a.type=='image'"
,
reset
:
"a.type=='reset'"
,
button
:
"a.type=='button'"
,
button
:
"a.type=='button'
||a.nodeName=='BUTTON'
"
,
input
:
"/input|select|textarea|button/i.test(a.nodeName)"
},
"."
:
"jQuery.className.has(a,m[2])"
,
...
...
@@ -3286,4 +3291,4 @@ jQuery.macros = {
}
};
jQuery
.
init
();
jQuery
.
init
();
\ No newline at end of file
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