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
efea0f23
Commit
efea0f23
authored
Mar 24, 2010
by
Brandon Aaron
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:jquery/jquery
parents
656fe921
96ea3d61
Changes
24
Show whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
222 additions
and
128 deletions
+222
-128
ajax.js
src/ajax.js
+2
-2
attributes.js
src/attributes.js
+1
-1
core.js
src/core.js
+39
-48
css.js
src/css.js
+1
-1
data.js
src/data.js
+1
-1
effects.js
src/effects.js
+2
-2
event.js
src/event.js
+1
-1
manipulation.js
src/manipulation.js
+16
-0
outro.js
src/outro.js
+0
-3
sizzle-jquery.js
src/sizzle-jquery.js
+3
-3
support.js
src/support.js
+1
-1
traversing.js
src/traversing.js
+33
-31
absolute.html
test/data/offset/absolute.html
+10
-1
body.html
test/data/offset/body.html
+9
-1
fixed.html
test/data/offset/fixed.html
+9
-1
relative.html
test/data/offset/relative.html
+9
-1
scroll.html
test/data/offset/scroll.html
+9
-1
static.html
test/data/offset/static.html
+9
-1
table.html
test/data/offset/table.html
+9
-1
testrunner.js
test/data/testrunner.js
+10
-0
index.html
test/index.html
+34
-17
ajax.js
test/unit/ajax.js
+5
-5
attributes.js
test/unit/attributes.js
+8
-4
dimensions.js
test/unit/dimensions.js
+1
-1
No files found.
src/ajax.js
View file @
efea0f23
var
jsc
=
now
(),
var
jsc
=
jQuery
.
now
(),
rscript
=
/<script
(
.|
\s)
*
?\/
script>/gi
,
rscript
=
/<script
(
.|
\s)
*
?\/
script>/gi
,
rselectTextarea
=
/select|textarea/i
,
rselectTextarea
=
/select|textarea/i
,
rinput
=
/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i
,
rinput
=
/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i
,
...
@@ -259,7 +259,7 @@ jQuery.extend({
...
@@ -259,7 +259,7 @@ jQuery.extend({
}
}
if
(
s
.
cache
===
false
&&
type
===
"GET"
)
{
if
(
s
.
cache
===
false
&&
type
===
"GET"
)
{
var
ts
=
now
();
var
ts
=
jQuery
.
now
();
// try replacing _= if it is there
// try replacing _= if it is there
var
ret
=
s
.
url
.
replace
(
rts
,
"$1_="
+
ts
+
"$2"
);
var
ret
=
s
.
url
.
replace
(
rts
,
"$1_="
+
ts
+
"$2"
);
...
...
src/attributes.js
View file @
efea0f23
...
@@ -9,7 +9,7 @@ var rclass = /[\n\t]/g,
...
@@ -9,7 +9,7 @@ var rclass = /[\n\t]/g,
jQuery
.
fn
.
extend
({
jQuery
.
fn
.
extend
({
attr
:
function
(
name
,
value
)
{
attr
:
function
(
name
,
value
)
{
return
access
(
this
,
name
,
value
,
true
,
jQuery
.
attr
);
return
jQuery
.
access
(
this
,
name
,
value
,
true
,
jQuery
.
attr
);
},
},
removeAttr
:
function
(
name
,
fn
)
{
removeAttr
:
function
(
name
,
fn
)
{
...
...
src/core.js
View file @
efea0f23
(
function
()
{
// Define a local copy of jQuery
// Define a local copy of jQuery
var
jQuery
=
function
(
selector
,
context
)
{
var
jQuery
=
function
(
selector
,
context
)
{
// The jQuery object is actually just the init constructor 'enhanced'
// The jQuery object is actually just the init constructor 'enhanced'
...
@@ -11,7 +13,7 @@ var jQuery = function( selector, context ) {
...
@@ -11,7 +13,7 @@ var jQuery = function( selector, context ) {
_$
=
window
.
$
,
_$
=
window
.
$
,
// Use the correct document accordingly with window argument (sandbox)
// Use the correct document accordingly with window argument (sandbox)
document
=
window
.
document
,
//
document = window.document,
// A central reference to the root jQuery(document)
// A central reference to the root jQuery(document)
rootjQuery
,
rootjQuery
,
...
@@ -699,6 +701,39 @@ jQuery.extend({
...
@@ -699,6 +701,39 @@ jQuery.extend({
return
proxy
;
return
proxy
;
},
},
// Mutifunctional method to get and set values to a collection
// The value/s can be optionally by executed if its a function
access
:
function
(
elems
,
key
,
value
,
exec
,
fn
,
pass
)
{
var
length
=
elems
.
length
;
// Setting many attributes
if
(
typeof
key
===
"object"
)
{
for
(
var
k
in
key
)
{
jQuery
.
access
(
elems
,
k
,
key
[
k
],
exec
,
fn
,
value
);
}
return
elems
;
}
// Setting one attribute
if
(
value
!==
undefined
)
{
// Optionally, function values get executed if exec is true
exec
=
!
pass
&&
exec
&&
jQuery
.
isFunction
(
value
);
for
(
var
i
=
0
;
i
<
length
;
i
++
)
{
fn
(
elems
[
i
],
key
,
exec
?
value
.
call
(
elems
[
i
],
i
,
fn
(
elems
[
i
],
key
)
)
:
value
,
pass
);
}
return
elems
;
}
// Getting an attribute
return
length
?
fn
(
elems
[
0
],
key
)
:
undefined
;
},
now
:
function
()
{
return
(
new
Date
()).
getTime
();
},
// Use of jQuery.browser is frowned upon.
// Use of jQuery.browser is frowned upon.
// More details: http://docs.jquery.com/Utilities/jQuery.browser
// More details: http://docs.jquery.com/Utilities/jQuery.browser
uaMatch
:
function
(
ua
)
{
uaMatch
:
function
(
ua
)
{
...
@@ -779,51 +814,7 @@ function doScrollCheck() {
...
@@ -779,51 +814,7 @@ function doScrollCheck() {
jQuery
.
ready
();
jQuery
.
ready
();
}
}
function
evalScript
(
i
,
elem
)
{
// Expose jQuery to the global object
if
(
elem
.
src
)
{
window
.
jQuery
=
window
.
$
=
jQuery
;
jQuery
.
ajax
({
url
:
elem
.
src
,
async
:
false
,
dataType
:
"script"
});
}
else
{
jQuery
.
globalEval
(
elem
.
text
||
elem
.
textContent
||
elem
.
innerHTML
||
""
);
}
if
(
elem
.
parentNode
)
{
})();
elem
.
parentNode
.
removeChild
(
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
,
pass
)
{
var
length
=
elems
.
length
;
// Setting many attributes
if
(
typeof
key
===
"object"
)
{
for
(
var
k
in
key
)
{
access
(
elems
,
k
,
key
[
k
],
exec
,
fn
,
value
);
}
return
elems
;
}
// Setting one attribute
if
(
value
!==
undefined
)
{
// Optionally, function values get executed if exec is true
exec
=
!
pass
&&
exec
&&
jQuery
.
isFunction
(
value
);
for
(
var
i
=
0
;
i
<
length
;
i
++
)
{
fn
(
elems
[
i
],
key
,
exec
?
value
.
call
(
elems
[
i
],
i
,
fn
(
elems
[
i
],
key
)
)
:
value
,
pass
);
}
return
elems
;
}
// Getting an attribute
return
length
?
fn
(
elems
[
0
],
key
)
:
undefined
;
}
function
now
()
{
return
(
new
Date
()).
getTime
();
}
src/css.js
View file @
efea0f23
...
@@ -21,7 +21,7 @@ var rexclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
...
@@ -21,7 +21,7 @@ var rexclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
};
};
jQuery
.
fn
.
css
=
function
(
name
,
value
)
{
jQuery
.
fn
.
css
=
function
(
name
,
value
)
{
return
access
(
this
,
name
,
value
,
true
,
function
(
elem
,
name
,
value
)
{
return
jQuery
.
access
(
this
,
name
,
value
,
true
,
function
(
elem
,
name
,
value
)
{
if
(
value
===
undefined
)
{
if
(
value
===
undefined
)
{
return
jQuery
.
curCSS
(
elem
,
name
);
return
jQuery
.
curCSS
(
elem
,
name
);
}
}
...
...
src/data.js
View file @
efea0f23
var
expando
=
"jQuery"
+
now
(),
uuid
=
0
,
windowData
=
{};
var
expando
=
"jQuery"
+
jQuery
.
now
(),
uuid
=
0
,
windowData
=
{};
jQuery
.
extend
({
jQuery
.
extend
({
cache
:
{},
cache
:
{},
...
...
src/effects.js
View file @
efea0f23
...
@@ -320,7 +320,7 @@ jQuery.fx.prototype = {
...
@@ -320,7 +320,7 @@ jQuery.fx.prototype = {
// Start an animation from one number to another
// Start an animation from one number to another
custom
:
function
(
from
,
to
,
unit
)
{
custom
:
function
(
from
,
to
,
unit
)
{
this
.
startTime
=
now
();
this
.
startTime
=
jQuery
.
now
();
this
.
start
=
from
;
this
.
start
=
from
;
this
.
end
=
to
;
this
.
end
=
to
;
this
.
unit
=
unit
||
this
.
unit
||
"px"
;
this
.
unit
=
unit
||
this
.
unit
||
"px"
;
...
@@ -366,7 +366,7 @@ jQuery.fx.prototype = {
...
@@ -366,7 +366,7 @@ jQuery.fx.prototype = {
// Each step of an animation
// Each step of an animation
step
:
function
(
gotoEnd
)
{
step
:
function
(
gotoEnd
)
{
var
t
=
now
(),
done
=
true
;
var
t
=
jQuery
.
now
(),
done
=
true
;
if
(
gotoEnd
||
t
>=
this
.
options
.
duration
+
this
.
startTime
)
{
if
(
gotoEnd
||
t
>=
this
.
options
.
duration
+
this
.
startTime
)
{
this
.
now
=
this
.
end
;
this
.
now
=
this
.
end
;
...
...
src/event.js
View file @
efea0f23
...
@@ -554,7 +554,7 @@ jQuery.Event = function( src ) {
...
@@ -554,7 +554,7 @@ jQuery.Event = function( src ) {
// timeStamp is buggy for some events on Firefox(#3843)
// timeStamp is buggy for some events on Firefox(#3843)
// So we won't rely on the native value
// So we won't rely on the native value
this.timeStamp = now();
this.timeStamp =
jQuery.
now();
// Mark it as fixed
// Mark it as fixed
this[ expando ] = true;
this[ expando ] = true;
...
...
src/manipulation.js
View file @
efea0f23
...
@@ -584,3 +584,19 @@ jQuery.extend({
...
@@ -584,3 +584,19 @@ jQuery.extend({
}
}
}
}
});
});
function
evalScript
(
i
,
elem
)
{
if
(
elem
.
src
)
{
jQuery
.
ajax
({
url
:
elem
.
src
,
async
:
false
,
dataType
:
"script"
});
}
else
{
jQuery
.
globalEval
(
elem
.
text
||
elem
.
textContent
||
elem
.
innerHTML
||
""
);
}
if
(
elem
.
parentNode
)
{
elem
.
parentNode
.
removeChild
(
elem
);
}
}
\ No newline at end of file
src/outro.js
View file @
efea0f23
// Expose jQuery to the global object
window
.
jQuery
=
window
.
$
=
jQuery
;
})(
window
);
})(
window
);
src/sizzle-jquery.js
View file @
efea0f23
...
@@ -2,6 +2,6 @@ jQuery.find = Sizzle;
...
@@ -2,6 +2,6 @@ jQuery.find = Sizzle;
jQuery
.
expr
=
Sizzle
.
selectors
;
jQuery
.
expr
=
Sizzle
.
selectors
;
jQuery
.
expr
[
":"
]
=
jQuery
.
expr
.
filters
;
jQuery
.
expr
[
":"
]
=
jQuery
.
expr
.
filters
;
jQuery
.
unique
=
Sizzle
.
uniqueSort
;
jQuery
.
unique
=
Sizzle
.
uniqueSort
;
jQuery
.
text
=
getText
;
jQuery
.
text
=
Sizzle
.
getText
;
jQuery
.
isXMLDoc
=
isXML
;
jQuery
.
isXMLDoc
=
Sizzle
.
isXML
;
jQuery
.
contains
=
contains
;
jQuery
.
contains
=
Sizzle
.
contains
;
src/support.js
View file @
efea0f23
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
var
root
=
document
.
documentElement
,
var
root
=
document
.
documentElement
,
script
=
document
.
createElement
(
"script"
),
script
=
document
.
createElement
(
"script"
),
div
=
document
.
createElement
(
"div"
),
div
=
document
.
createElement
(
"div"
),
id
=
"script"
+
now
();
id
=
"script"
+
jQuery
.
now
();
div
.
style
.
display
=
"none"
;
div
.
style
.
display
=
"none"
;
div
.
innerHTML
=
" <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>"
;
div
.
innerHTML
=
" <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>"
;
...
...
src/traversing.js
View file @
efea0f23
var
runtil
=
/Until$/
,
var
runtil
=
/Until$/
,
rparentsprev
=
/^
(?:
parents|prevUntil|prevAll
)
/
,
rparentsprev
=
/^
(?:
parents|prevUntil|prevAll
)
/
,
// Note: This RegExp should be improved, or likely pulled from Sizzle
// Note: This RegExp should be improved, or likely pulled from Sizzle
rmultiselector
=
/,/
;
rmultiselector
=
/,/
,
isSimple
=
/^.
[^
:#
\[\.
,
]
*$/
,
// Implement the identical functionality for filter and not
slice
=
Array
.
prototype
.
slice
;
var
winnow
=
function
(
elements
,
qualifier
,
keep
)
{
if
(
jQuery
.
isFunction
(
qualifier
)
)
{
return
jQuery
.
grep
(
elements
,
function
(
elem
,
i
)
{
var
retVal
=
!!
qualifier
.
call
(
elem
,
i
,
elem
);
return
retVal
===
keep
;
});
}
else
if
(
qualifier
.
nodeType
)
{
return
jQuery
.
grep
(
elements
,
function
(
elem
,
i
)
{
return
(
elem
===
qualifier
)
===
keep
;
});
}
else
if
(
typeof
qualifier
===
"string"
)
{
var
filtered
=
jQuery
.
grep
(
elements
,
function
(
elem
)
{
return
elem
.
nodeType
===
1
;
});
if
(
isSimple
.
test
(
qualifier
)
)
{
return
jQuery
.
filter
(
qualifier
,
filtered
,
!
keep
);
}
else
{
qualifier
=
jQuery
.
filter
(
qualifier
,
filtered
);
}
}
return
jQuery
.
grep
(
elements
,
function
(
elem
,
i
)
{
return
(
jQuery
.
inArray
(
elem
,
qualifier
)
>=
0
)
===
keep
;
});
};
jQuery
.
fn
.
extend
({
jQuery
.
fn
.
extend
({
find
:
function
(
selector
)
{
find
:
function
(
selector
)
{
...
@@ -269,3 +241,33 @@ jQuery.extend({
...
@@ -269,3 +241,33 @@ jQuery.extend({
return
r
;
return
r
;
}
}
});
});
// Implement the identical functionality for filter and not
function
winnow
(
elements
,
qualifier
,
keep
)
{
if
(
jQuery
.
isFunction
(
qualifier
)
)
{
return
jQuery
.
grep
(
elements
,
function
(
elem
,
i
)
{
var
retVal
=
!!
qualifier
.
call
(
elem
,
i
,
elem
);
return
retVal
===
keep
;
});
}
else
if
(
qualifier
.
nodeType
)
{
return
jQuery
.
grep
(
elements
,
function
(
elem
,
i
)
{
return
(
elem
===
qualifier
)
===
keep
;
});
}
else
if
(
typeof
qualifier
===
"string"
)
{
var
filtered
=
jQuery
.
grep
(
elements
,
function
(
elem
)
{
return
elem
.
nodeType
===
1
;
});
if
(
isSimple
.
test
(
qualifier
)
)
{
return
jQuery
.
filter
(
qualifier
,
filtered
,
!
keep
);
}
else
{
qualifier
=
jQuery
.
filter
(
qualifier
,
filtered
);
}
}
return
jQuery
.
grep
(
elements
,
function
(
elem
,
i
)
{
return
(
jQuery
.
inArray
(
elem
,
qualifier
)
>=
0
)
===
keep
;
});
};
\ No newline at end of file
test/data/offset/absolute.html
View file @
efea0f23
...
@@ -15,6 +15,15 @@
...
@@ -15,6 +15,15 @@
p
.instructions
{
position
:
absolute
;
bottom
:
0
;
}
p
.instructions
{
position
:
absolute
;
bottom
:
0
;
}
#positionTest
{
position
:
absolute
;
}
#positionTest
{
position
:
absolute
;
}
</style>
</style>
<script
src=
"../../../src/core.js"
></script>
<script
src=
"../../../src/support.js"
></script>
<script
src=
"../../../src/sizzle/sizzle.js"
></script>
<script
src=
"../../../src/sizzle-jquery.js"
></script>
<script
src=
"../../../src/traversing.js"
></script>
<script
src=
"../../../src/data.js"
></script>
<script
src=
"../../../src/event.js"
></script>
<script
src=
"../../../src/css.js"
></script>
<script
src=
"../../../src/offset.js"
></script>
<script
type=
"text/javascript"
src=
"../../../dist/jquery.js"
></script>
<script
type=
"text/javascript"
src=
"../../../dist/jquery.js"
></script>
<script
type=
"text/javascript"
charset=
"utf-8"
>
<script
type=
"text/javascript"
charset=
"utf-8"
>
$
(
function
()
{
$
(
function
()
{
...
...
test/data/offset/body.html
View file @
efea0f23
...
@@ -8,7 +8,15 @@
...
@@ -8,7 +8,15 @@
body
{
margin
:
1px
;
padding
:
5px
;
}
body
{
margin
:
1px
;
padding
:
5px
;
}
#marker
{
position
:
absolute
;
border
:
2px
solid
#000
;
width
:
50px
;
height
:
50px
;
background
:
#ccc
;
}
#marker
{
position
:
absolute
;
border
:
2px
solid
#000
;
width
:
50px
;
height
:
50px
;
background
:
#ccc
;
}
</style>
</style>
<script
type=
"text/javascript"
src=
"../../../dist/jquery.js"
></script>
<script
src=
"../../../src/core.js"
></script>
<script
src=
"../../../src/support.js"
></script>
<script
src=
"../../../src/sizzle/sizzle.js"
></script>
<script
src=
"../../../src/sizzle-jquery.js"
></script>
<script
src=
"../../../src/traversing.js"
></script>
<script
src=
"../../../src/data.js"
></script>
<script
src=
"../../../src/event.js"
></script>
<script
src=
"../../../src/css.js"
></script>
<script
src=
"../../../src/offset.js"
></script>
<script
type=
"text/javascript"
charset=
"utf-8"
>
<script
type=
"text/javascript"
charset=
"utf-8"
>
$
(
function
()
{
$
(
function
()
{
$
(
'body'
).
click
(
function
()
{
$
(
'body'
).
click
(
function
()
{
...
...
test/data/offset/fixed.html
View file @
efea0f23
...
@@ -12,7 +12,15 @@
...
@@ -12,7 +12,15 @@
#forceScroll
{
width
:
5000px
;
height
:
5000px
;
}
#forceScroll
{
width
:
5000px
;
height
:
5000px
;
}
#marker
{
position
:
absolute
;
border
:
2px
solid
#000
;
width
:
50px
;
height
:
50px
;
background
:
#ccc
;
}
#marker
{
position
:
absolute
;
border
:
2px
solid
#000
;
width
:
50px
;
height
:
50px
;
background
:
#ccc
;
}
</style>
</style>
<script
type=
"text/javascript"
src=
"../../../dist/jquery.js"
></script>
<script
src=
"../../../src/core.js"
></script>
<script
src=
"../../../src/support.js"
></script>
<script
src=
"../../../src/sizzle/sizzle.js"
></script>
<script
src=
"../../../src/sizzle-jquery.js"
></script>
<script
src=
"../../../src/traversing.js"
></script>
<script
src=
"../../../src/data.js"
></script>
<script
src=
"../../../src/event.js"
></script>
<script
src=
"../../../src/css.js"
></script>
<script
src=
"../../../src/offset.js"
></script>
<script
type=
"text/javascript"
charset=
"utf-8"
>
<script
type=
"text/javascript"
charset=
"utf-8"
>
$
(
function
()
{
$
(
function
()
{
window
.
scrollTo
(
1000
,
1000
);
window
.
scrollTo
(
1000
,
1000
);
...
...
test/data/offset/relative.html
View file @
efea0f23
...
@@ -10,7 +10,15 @@
...
@@ -10,7 +10,15 @@
#relative-2
{
top
:
20px
;
left
:
20px
;
}
#relative-2
{
top
:
20px
;
left
:
20px
;
}
#marker
{
position
:
absolute
;
border
:
2px
solid
#000
;
width
:
50px
;
height
:
50px
;
background
:
#ccc
;
}
#marker
{
position
:
absolute
;
border
:
2px
solid
#000
;
width
:
50px
;
height
:
50px
;
background
:
#ccc
;
}
</style>
</style>
<script
type=
"text/javascript"
src=
"../../../dist/jquery.js"
></script>
<script
src=
"../../../src/core.js"
></script>
<script
src=
"../../../src/support.js"
></script>
<script
src=
"../../../src/sizzle/sizzle.js"
></script>
<script
src=
"../../../src/sizzle-jquery.js"
></script>
<script
src=
"../../../src/traversing.js"
></script>
<script
src=
"../../../src/data.js"
></script>
<script
src=
"../../../src/event.js"
></script>
<script
src=
"../../../src/css.js"
></script>
<script
src=
"../../../src/offset.js"
></script>
<script
type=
"text/javascript"
charset=
"utf-8"
>
<script
type=
"text/javascript"
charset=
"utf-8"
>
$
(
function
()
{
$
(
function
()
{
$
(
'.relative'
).
click
(
function
()
{
$
(
'.relative'
).
click
(
function
()
{
...
...
test/data/offset/scroll.html
View file @
efea0f23
...
@@ -13,7 +13,15 @@
...
@@ -13,7 +13,15 @@
#forceScroll
{
width
:
5000px
;
height
:
5000px
;
}
#forceScroll
{
width
:
5000px
;
height
:
5000px
;
}
#marker
{
position
:
absolute
;
border
:
2px
solid
#000
;
width
:
50px
;
height
:
50px
;
background
:
#ccc
;
}
#marker
{
position
:
absolute
;
border
:
2px
solid
#000
;
width
:
50px
;
height
:
50px
;
background
:
#ccc
;
}
</style>
</style>
<script
type=
"text/javascript"
src=
"../../../dist/jquery.js"
></script>
<script
src=
"../../../src/core.js"
></script>
<script
src=
"../../../src/support.js"
></script>
<script
src=
"../../../src/sizzle/sizzle.js"
></script>
<script
src=
"../../../src/sizzle-jquery.js"
></script>
<script
src=
"../../../src/traversing.js"
></script>
<script
src=
"../../../src/data.js"
></script>
<script
src=
"../../../src/event.js"
></script>
<script
src=
"../../../src/css.js"
></script>
<script
src=
"../../../src/offset.js"
></script>
<script
type=
"text/javascript"
charset=
"utf-8"
>
<script
type=
"text/javascript"
charset=
"utf-8"
>
$
(
function
()
{
$
(
function
()
{
window
.
scrollTo
(
1000
,
1000
);
window
.
scrollTo
(
1000
,
1000
);
...
...
test/data/offset/static.html
View file @
efea0f23
...
@@ -10,7 +10,15 @@
...
@@ -10,7 +10,15 @@
#static-2
{
top
:
20px
;
left
:
20px
;
}
#static-2
{
top
:
20px
;
left
:
20px
;
}
#marker
{
position
:
absolute
;
border
:
2px
solid
#000
;
width
:
50px
;
height
:
50px
;
background
:
#ccc
;
}
#marker
{
position
:
absolute
;
border
:
2px
solid
#000
;
width
:
50px
;
height
:
50px
;
background
:
#ccc
;
}
</style>
</style>
<script
type=
"text/javascript"
src=
"../../../dist/jquery.js"
></script>
<script
src=
"../../../src/core.js"
></script>
<script
src=
"../../../src/support.js"
></script>
<script
src=
"../../../src/sizzle/sizzle.js"
></script>
<script
src=
"../../../src/sizzle-jquery.js"
></script>
<script
src=
"../../../src/traversing.js"
></script>
<script
src=
"../../../src/data.js"
></script>
<script
src=
"../../../src/event.js"
></script>
<script
src=
"../../../src/css.js"
></script>
<script
src=
"../../../src/offset.js"
></script>
<script
type=
"text/javascript"
charset=
"utf-8"
>
<script
type=
"text/javascript"
charset=
"utf-8"
>
$
(
function
()
{
$
(
function
()
{
$
(
'.static'
).
click
(
function
()
{
$
(
'.static'
).
click
(
function
()
{
...
...
test/data/offset/table.html
View file @
efea0f23
...
@@ -10,7 +10,15 @@
...
@@ -10,7 +10,15 @@
th
,
td
{
border
:
1px
solid
#000
;
width
:
100px
;
height
:
100px
;
}
th
,
td
{
border
:
1px
solid
#000
;
width
:
100px
;
height
:
100px
;
}
#marker
{
position
:
absolute
;
border
:
2px
solid
#000
;
width
:
50px
;
height
:
50px
;
background
:
#ccc
;
}
#marker
{
position
:
absolute
;
border
:
2px
solid
#000
;
width
:
50px
;
height
:
50px
;
background
:
#ccc
;
}
</style>
</style>
<script
type=
"text/javascript"
src=
"../../../dist/jquery.js"
></script>
<script
src=
"../../../src/core.js"
></script>
<script
src=
"../../../src/support.js"
></script>
<script
src=
"../../../src/sizzle/sizzle.js"
></script>
<script
src=
"../../../src/sizzle-jquery.js"
></script>
<script
src=
"../../../src/traversing.js"
></script>
<script
src=
"../../../src/data.js"
></script>
<script
src=
"../../../src/event.js"
></script>
<script
src=
"../../../src/css.js"
></script>
<script
src=
"../../../src/offset.js"
></script>
<script
type=
"text/javascript"
charset=
"utf-8"
>
<script
type=
"text/javascript"
charset=
"utf-8"
>
$
(
function
()
{
$
(
function
()
{
$
(
'table, th, td'
).
click
(
function
()
{
$
(
'table, th, td'
).
click
(
function
()
{
...
...
test/data/testrunner.js
View file @
efea0f23
jQuery
.
noConflict
();
// Allow the test to run with other libs or jQuery's.
jQuery
.
noConflict
();
// Allow the test to run with other libs or jQuery's.
// load testswarm agent
(
function
()
{
var
url
=
window
.
location
.
search
;
url
=
decodeURIComponent
(
url
.
slice
(
url
.
indexOf
(
"swarmURL="
)
+
9
)
);
if
(
!
url
||
url
.
indexOf
(
"http"
)
!==
0
)
{
return
;
}
document
.
write
(
"<scr"
+
"ipt src='http://swarm.jquery.org/js/inject.js?"
+
(
new
Date
).
getTime
()
+
"'></scr"
+
"ipt>"
);
})();
test/index.html
View file @
efea0f23
...
@@ -6,23 +6,40 @@
...
@@ -6,23 +6,40 @@
<link
rel=
"Stylesheet"
media=
"screen"
href=
"qunit/qunit/qunit.css"
/>
<link
rel=
"Stylesheet"
media=
"screen"
href=
"qunit/qunit/qunit.css"
/>
<link
rel=
"Stylesheet"
media=
"screen"
href=
"data/testsuite.css"
/>
<link
rel=
"Stylesheet"
media=
"screen"
href=
"data/testsuite.css"
/>
<!-- Includes -->
<!-- Includes -->
<script
type=
"text/javascript"
src=
"data/testinit.js"
></script>
<script
src=
"data/testinit.js"
></script>
<script
type=
"text/javascript"
src=
"../dist/jquery.js"
></script>
<script
type=
"text/javascript"
src=
"qunit/qunit/qunit.js"
></script>
<script
src=
"../src/core.js"
></script>
<script
type=
"text/javascript"
src=
"data/testrunner.js"
></script>
<script
src=
"../src/support.js"
></script>
<script
type=
"text/javascript"
src=
"unit/core.js"
></script>
<script
src=
"../src/data.js"
></script>
<script
type=
"text/javascript"
src=
"unit/data.js"
></script>
<script
src=
"../src/queue.js"
></script>
<script
type=
"text/javascript"
src=
"unit/queue.js"
></script>
<script
src=
"../src/attributes.js"
></script>
<script
type=
"text/javascript"
src=
"unit/attributes.js"
></script>
<script
src=
"../src/event.js"
></script>
<script
type=
"text/javascript"
src=
"unit/css.js"
></script>
<script
src=
"../src/sizzle/sizzle.js"
></script>
<script
type=
"text/javascript"
src=
"unit/traversing.js"
></script>
<script
src=
"../src/sizzle-jquery.js"
></script>
<script
type=
"text/javascript"
src=
"unit/manipulation.js"
></script>
<script
src=
"../src/traversing.js"
></script>
<script
type=
"text/javascript"
src=
"unit/dimensions.js"
></script>
<script
src=
"../src/manipulation.js"
></script>
<script
type=
"text/javascript"
src=
"unit/selector.js"
></script>
<script
src=
"../src/css.js"
></script>
<script
type=
"text/javascript"
src=
"unit/event.js"
></script>
<script
src=
"../src/ajax.js"
></script>
<script
type=
"text/javascript"
src=
"unit/ajax.js"
></script>
<script
src=
"../src/effects.js"
></script>
<script
type=
"text/javascript"
src=
"unit/effects.js"
></script>
<script
src=
"../src/offset.js"
></script>
<script
type=
"text/javascript"
src=
"unit/offset.js"
></script>
<script
src=
"../src/dimensions.js"
></script>
<script
src=
"qunit/qunit/qunit.js"
></script>
<script
src=
"data/testrunner.js"
></script>
<script
src=
"unit/core.js"
></script>
<script
src=
"unit/data.js"
></script>
<script
src=
"unit/queue.js"
></script>
<script
src=
"unit/attributes.js"
></script>
<script
src=
"unit/event.js"
></script>
<script
src=
"unit/selector.js"
></script>
<script
src=
"unit/traversing.js"
></script>
<script
src=
"unit/manipulation.js"
></script>
<script
src=
"unit/css.js"
></script>
<script
src=
"unit/ajax.js"
></script>
<script
src=
"unit/effects.js"
></script>
<script
src=
"unit/offset.js"
></script>
<script
src=
"unit/dimensions.js"
></script>
</head>
</head>
<body
id=
"body"
>
<body
id=
"body"
>
...
...
test/unit/ajax.js
View file @
efea0f23
...
@@ -774,7 +774,7 @@ test("jQuery.ajax() - JSONP, Remote", function() {
...
@@ -774,7 +774,7 @@ test("jQuery.ajax() - JSONP, Remote", function() {
var
count
=
0
;
var
count
=
0
;
function
plus
(){
if
(
++
count
==
4
)
start
();
}
function
plus
(){
if
(
++
count
==
4
)
start
();
}
var
base
=
window
.
location
.
href
.
replace
(
/
\?
.
*$/
,
""
);
var
base
=
window
.
location
.
href
.
replace
(
/
[^\/]
*$/
,
""
);
stop
();
stop
();
...
@@ -836,7 +836,7 @@ test("jQuery.ajax() - JSONP, Remote", function() {
...
@@ -836,7 +836,7 @@ test("jQuery.ajax() - JSONP, Remote", function() {
test
(
"jQuery.ajax() - script, Remote"
,
function
()
{
test
(
"jQuery.ajax() - script, Remote"
,
function
()
{
expect
(
2
);
expect
(
2
);
var
base
=
window
.
location
.
href
.
replace
(
/
\?
.
*$/
,
""
);
var
base
=
window
.
location
.
href
.
replace
(
/
[^\/]
*$/
,
""
);
stop
();
stop
();
...
@@ -853,7 +853,7 @@ test("jQuery.ajax() - script, Remote", function() {
...
@@ -853,7 +853,7 @@ test("jQuery.ajax() - script, Remote", function() {
test
(
"jQuery.ajax() - script, Remote with POST"
,
function
()
{
test
(
"jQuery.ajax() - script, Remote with POST"
,
function
()
{
expect
(
3
);
expect
(
3
);
var
base
=
window
.
location
.
href
.
replace
(
/
\?
.
*$/
,
""
);
var
base
=
window
.
location
.
href
.
replace
(
/
[^\/]
*$/
,
""
);
stop
();
stop
();
...
@@ -876,7 +876,7 @@ test("jQuery.ajax() - script, Remote with POST", function() {
...
@@ -876,7 +876,7 @@ test("jQuery.ajax() - script, Remote with POST", function() {
test
(
"jQuery.ajax() - script, Remote with scheme-less URL"
,
function
()
{
test
(
"jQuery.ajax() - script, Remote with scheme-less URL"
,
function
()
{
expect
(
2
);
expect
(
2
);
var
base
=
window
.
location
.
href
.
replace
(
/
\?
.
*$/
,
""
);
var
base
=
window
.
location
.
href
.
replace
(
/
[^\/]
*$/
,
""
);
base
=
base
.
replace
(
/^.*
?\/\/
/
,
"//"
);
base
=
base
.
replace
(
/^.*
?\/\/
/
,
"//"
);
stop
();
stop
();
...
@@ -991,7 +991,7 @@ test("jQuery.getJSON - Using Native JSON", function() {
...
@@ -991,7 +991,7 @@ test("jQuery.getJSON - Using Native JSON", function() {
test
(
"jQuery.getJSON(String, Function) - JSON object with absolute url to local content"
,
function
()
{
test
(
"jQuery.getJSON(String, Function) - JSON object with absolute url to local content"
,
function
()
{
expect
(
2
);
expect
(
2
);
var
base
=
window
.
location
.
href
.
replace
(
/
\?
.
*$/
,
""
);
var
base
=
window
.
location
.
href
.
replace
(
/
[^\/]
*$/
,
""
);
stop
();
stop
();
jQuery
.
getJSON
(
url
(
base
+
"data/json.php"
),
function
(
json
)
{
jQuery
.
getJSON
(
url
(
base
+
"data/json.php"
),
function
(
json
)
{
...
...
test/unit/attributes.js
View file @
efea0f23
...
@@ -482,8 +482,10 @@ test("addClass(Function) with incoming value", function() {
...
@@ -482,8 +482,10 @@ test("addClass(Function) with incoming value", function() {
});
});
div
.
addClass
(
function
(
i
,
val
)
{
div
.
addClass
(
function
(
i
,
val
)
{
if
(
this
.
id
!==
"_firebugConsole"
)
{
equals
(
val
,
old
[
i
],
"Make sure the incoming value is correct."
);
equals
(
val
,
old
[
i
],
"Make sure the incoming value is correct."
);
return
"test"
;
return
"test"
;
}
});
});
var
pass
=
true
;
var
pass
=
true
;
...
@@ -553,8 +555,10 @@ test("removeClass(Function) with incoming value", function() {
...
@@ -553,8 +555,10 @@ test("removeClass(Function) with incoming value", function() {
});
});
$divs
.
removeClass
(
function
(
i
,
val
)
{
$divs
.
removeClass
(
function
(
i
,
val
)
{
if
(
this
.
id
!==
"_firebugConsole"
)
{
equals
(
val
,
old
[
i
],
"Make sure the incoming value is correct."
);
equals
(
val
,
old
[
i
],
"Make sure the incoming value is correct."
);
return
"test"
;
return
"test"
;
}
});
});
ok
(
!
$divs
.
is
(
'.test'
),
"Remove Class"
);
ok
(
!
$divs
.
is
(
'.test'
),
"Remove Class"
);
...
...
test/unit/dimensions.js
View file @
efea0f23
...
@@ -26,7 +26,7 @@ function testWidth( val ) {
...
@@ -26,7 +26,7 @@ function testWidth( val ) {
$div
.
css
({
display
:
""
,
border
:
""
,
padding
:
""
});
$div
.
css
({
display
:
""
,
border
:
""
,
padding
:
""
});
jQuery
(
"#nothiddendivchild"
).
css
({
padding
:
"3px"
,
border
:
"2px solid #fff"
});
jQuery
(
"#nothiddendivchild"
).
css
({
width
:
20
,
padding
:
"3px"
,
border
:
"2px solid #fff"
});
equals
(
jQuery
(
"#nothiddendivchild"
).
width
(),
20
,
"Test child width with border and padding"
);
equals
(
jQuery
(
"#nothiddendivchild"
).
width
(),
20
,
"Test child width with border and padding"
);
jQuery
(
"#nothiddendiv, #nothiddendivchild"
).
css
({
border
:
""
,
padding
:
""
,
width
:
""
});
jQuery
(
"#nothiddendiv, #nothiddendivchild"
).
css
({
border
:
""
,
padding
:
""
,
width
:
""
});
...
...
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