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
7d57c677
Commit
7d57c677
authored
Jul 15, 2006
by
John Resig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some more quick fixes.
parent
b84acca0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
71 additions
and
52 deletions
+71
-52
jquery.js
jquery/jquery.js
+71
-52
No files found.
jquery/jquery.js
View file @
7d57c677
...
@@ -29,7 +29,7 @@ function jQuery(a,c) {
...
@@ -29,7 +29,7 @@ function jQuery(a,c) {
* Handle support for overriding other $() functions. Way too many libraries
* Handle support for overriding other $() functions. Way too many libraries
* provide this function to simply ignore it and overwrite it.
* provide this function to simply ignore it and overwrite it.
*/
*/
/*
// Check to see if this is a possible collision case
// Check to see if this is a possible collision case
if ( jQuery._$ && !c && a.constructor == String &&
if ( jQuery._$ && !c && a.constructor == String &&
...
@@ -42,6 +42,7 @@ function jQuery(a,c) {
...
@@ -42,6 +42,7 @@ function jQuery(a,c) {
// Use the default method, in case it works some voodoo
// Use the default method, in case it works some voodoo
return jQuery._$( a );
return jQuery._$( a );
*/
// Watch for when a jQuery object is passed as the selector
// Watch for when a jQuery object is passed as the selector
if
(
a
.
jquery
)
if
(
a
.
jquery
)
...
@@ -55,10 +56,14 @@ function jQuery(a,c) {
...
@@ -55,10 +56,14 @@ function jQuery(a,c) {
if
(
window
==
this
)
if
(
window
==
this
)
return
new
jQuery
(
a
,
c
);
return
new
jQuery
(
a
,
c
);
// Handle HTML strings
var
m
=
/^
[^
<
]
*
(
<.+>
)[^
>
]
*$/
.
exec
(
a
);
if
(
m
)
a
=
jQuery
.
clean
(
[
m
[
1
]
]
);
// Watch for when an array is passed in
// Watch for when an array is passed in
this
.
get
(
a
.
constructor
==
Array
?
this
.
get
(
a
.
constructor
==
Array
||
a
.
length
&&
a
[
0
].
nodeType
?
// Assume that it's an array of DOM Elements
// Assume that it's an array of DOM Elements
a
:
jQuery
.
merge
(
a
,
[]
)
:
// Find the matching elements and save them for later
// Find the matching elements and save them for later
jQuery
.
find
(
a
,
c
)
);
jQuery
.
find
(
a
,
c
)
);
...
@@ -529,15 +534,21 @@ jQuery.fn = jQuery.prototype = {
...
@@ -529,15 +534,21 @@ jQuery.fn = jQuery.prototype = {
* @param Array<String> exprs A set of expressions to evaluate against
* @param Array<String> exprs A set of expressions to evaluate against
*/
*/
filter
:
function
(
t
)
{
filter
:
function
(
t
)
{
return
t
.
constructor
==
Array
?
return
t
his
.
pushStack
(
// Multi Filtering
t
.
constructor
==
Array
&&
this
.
pushStack
(
jQuery
.
map
(
this
,
function
(
a
){
jQuery
.
map
(
this
,
function
(
a
){
for
(
var
i
=
0
;
i
<
t
.
length
;
i
++
)
for
(
var
i
=
0
;
i
<
t
.
length
;
i
++
)
if
(
jQuery
.
filter
(
t
[
i
],[
a
]).
r
.
length
)
if
(
jQuery
.
filter
(
t
[
i
],[
a
]).
r
.
length
)
return
a
;
return
a
;
}),
arguments
)
:
})
||
t
.
constructor
==
Boolean
&&
(
t
?
this
.
get
()
:
[]
)
||
t
.
constructor
==
Function
&&
jQuery
.
grep
(
this
,
t
)
||
this
.
pushStack
(
jQuery
.
filter
(
t
,
this
).
r
,
arguments
);
jQuery
.
filter
(
t
,
this
).
r
,
arguments
);
},
},
/**
/**
...
@@ -625,7 +636,7 @@ jQuery.fn = jQuery.prototype = {
...
@@ -625,7 +636,7 @@ jQuery.fn = jQuery.prototype = {
* @type Boolean
* @type Boolean
*/
*/
is
:
function
(
expr
)
{
is
:
function
(
expr
)
{
return
jQuery
.
filter
(
expr
,
this
).
r
.
length
>
0
;
return
expr
?
jQuery
.
filter
(
expr
,
this
).
r
.
length
>
0
:
this
.
length
>
0
;
},
},
/**
/**
...
@@ -655,10 +666,12 @@ jQuery.fn = jQuery.prototype = {
...
@@ -655,10 +666,12 @@ jQuery.fn = jQuery.prototype = {
}
else
}
else
obj
=
tbody
[
0
];
obj
=
tbody
[
0
];
}
}
//alert( obj );
for
(
var
i
=
(
dir
<
0
?
a
.
length
-
1
:
0
);
for
(
var
i
=
(
dir
<
0
?
a
.
length
-
1
:
0
);
i
!=
(
dir
<
0
?
dir
:
a
.
length
);
i
+=
dir
)
i
!=
(
dir
<
0
?
dir
:
a
.
length
);
i
+=
dir
)
{
fn
.
apply
(
obj
,
[
a
[
i
]
]
);
fn
.
apply
(
obj
,
[
clone
?
a
[
i
].
cloneNode
(
true
)
:
a
[
i
]
]
);
//alert( fn );
}
});
});
},
},
...
@@ -798,7 +811,7 @@ new function() {
...
@@ -798,7 +811,7 @@ new function() {
* @type jQuery
* @type jQuery
* @param String expr An expression to filter the next Elements with
* @param String expr An expression to filter the next Elements with
*/
*/
next
:
"
a.nextSibling
"
,
next
:
"
jQuery.sibling(a).next
"
,
/**
/**
* Get a set of elements containing the unique previous siblings of each of the
* Get a set of elements containing the unique previous siblings of each of the
...
@@ -828,7 +841,7 @@ new function() {
...
@@ -828,7 +841,7 @@ new function() {
* @type jQuery
* @type jQuery
* @param String expr An expression to filter the previous Elements with
* @param String expr An expression to filter the previous Elements with
*/
*/
prev
:
"
a.previousSibling
"
,
prev
:
"
jQuery.sibling(a).prev
"
,
/**
/**
* Get a set of elements containing all of the unique siblings of each of the
* Get a set of elements containing all of the unique siblings of each of the
...
@@ -861,12 +874,15 @@ new function() {
...
@@ -861,12 +874,15 @@ new function() {
var
t
=
axis
[
i
];
var
t
=
axis
[
i
];
jQuery
.
fn
[
i
]
=
function
(
a
)
{
jQuery
.
fn
[
i
]
=
function
(
a
)
{
var
ret
=
jQuery
.
map
(
this
,
t
);
var
ret
=
jQuery
.
map
(
this
,
t
);
if
(
a
)
ret
=
jQuery
.
filter
(
a
,
ret
).
r
;
if
(
a
&&
a
.
constructor
==
String
)
ret
=
jQuery
.
filter
(
a
,
ret
).
r
;
return
this
.
pushStack
(
ret
,
arguments
);
return
this
.
pushStack
(
ret
,
arguments
);
};
};
}
};
// appendTo, prependTo, beforeTo, afterTo
/*
var to = ["append","prepend","before","after"];
var
to
=
[
"append"
,
"prepend"
,
"before"
,
"after"
];
for
(
var
i
=
0
;
i
<
to
.
length
;
i
++
)
new
function
(){
for
(
var
i
=
0
;
i
<
to
.
length
;
i
++
)
new
function
(){
var
n
=
to
[
i
];
var
n
=
to
[
i
];
...
@@ -877,7 +893,7 @@ new function() {
...
@@ -877,7 +893,7 @@ new function() {
$
(
a
[
i
])[
n
](
this
);
$
(
a
[
i
])[
n
](
this
);
});
});
};
};
}
*/
}
;
var
each
=
{
var
each
=
{
/**
/**
...
@@ -974,7 +990,7 @@ new function() {
...
@@ -974,7 +990,7 @@ new function() {
* @param String class A CSS class with which to toggle the elements
* @param String class A CSS class with which to toggle the elements
*/
*/
toggleClass
:
function
(
c
){
toggleClass
:
function
(
c
){
jQuery
.
className
[
jQuery
.
className
.
has
(
this
,
a
)
?
"remove"
:
"add"
](
this
,
c
);
jQuery
.
className
[
jQuery
.
className
.
has
(
this
,
c
)
?
"remove"
:
"add"
](
this
,
c
);
},
},
/**
/**
...
@@ -1026,6 +1042,8 @@ new function() {
...
@@ -1026,6 +1042,8 @@ new function() {
* @param Function fn A function to bind to the event on each of the set of matched elements
* @param Function fn A function to bind to the event on each of the set of matched elements
*/
*/
bind
:
function
(
type
,
fn
)
{
bind
:
function
(
type
,
fn
)
{
if
(
fn
.
constructor
==
String
)
fn
=
new
Function
(
"e"
,
(
!
fn
.
indexOf
(
"."
)
?
"$(this)"
:
"return "
)
+
fn
);
jQuery
.
event
.
add
(
this
,
type
,
fn
);
jQuery
.
event
.
add
(
this
,
type
,
fn
);
},
},
...
@@ -1083,7 +1101,7 @@ new function() {
...
@@ -1083,7 +1101,7 @@ new function() {
};
};
for
(
var
i
in
attr
)
new
function
()
{
for
(
var
i
in
attr
)
new
function
()
{
var
n
=
attr
[
i
];
var
n
=
attr
[
i
]
||
i
;
jQuery
.
fn
[
i
]
=
function
(
h
)
{
jQuery
.
fn
[
i
]
=
function
(
h
)
{
return
h
==
undefined
?
return
h
==
undefined
?
this
.
length
?
this
[
0
][
n
]
:
null
:
this
.
length
?
this
[
0
][
n
]
:
null
:
...
@@ -1510,6 +1528,7 @@ jQuery.extend({
...
@@ -1510,6 +1528,7 @@ jQuery.extend({
n
==
"even"
&&
type
.
n
%
2
==
0
||
n
==
"even"
&&
type
.
n
%
2
==
0
||
n
==
"odd"
&&
type
.
n
%
2
||
n
==
"odd"
&&
type
.
n
%
2
||
type
[
n
]
==
a
;
type
[
n
]
==
a
;
type
.
prev
=
type
[
type
.
n
-
1
];
type
.
next
=
type
[
type
.
n
+
1
];
type
.
next
=
type
[
type
.
n
+
1
];
return
type
;
return
type
;
},
},
...
...
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