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
f1dcaad0
Commit
f1dcaad0
authored
May 18, 2012
by
Trey Hunner
Committed by
Dave Methvin
May 18, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix indentation in /speed and /test dirs, closes gh-780.
parent
c4df0c91
Changes
18
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
651 additions
and
651 deletions
+651
-651
benchmark.js
speed/benchmark.js
+4
-4
benchmarker.css
speed/benchmarker.css
+15
-15
benchmarker.js
speed/benchmarker.js
+38
-38
closest.html
speed/closest.html
+20
-20
filter.html
speed/filter.html
+163
-163
find.html
speed/find.html
+161
-161
index.html
speed/index.html
+34
-34
jquery-basis.js
speed/jquery-basis.js
+1
-1
csp.php
test/csp.php
+2
-2
etag.php
test/data/etag.php
+2
-2
asyncReady.html
test/data/event/asyncReady.html
+2
-2
if_modified_since.php
test/data/if_modified_since.php
+2
-2
iframe.html
test/data/iframe.html
+6
-6
delegatetest.html
test/delegatetest.html
+27
-27
hovertest.html
test/hovertest.html
+26
-26
polluted.php
test/polluted.php
+1
-1
ajax.js
test/unit/ajax.js
+95
-95
core.js
test/unit/core.js
+52
-52
No files found.
speed/benchmark.js
View file @
f1dcaad0
...
@@ -5,11 +5,11 @@ function benchmark(fn, times, name){
...
@@ -5,11 +5,11 @@ function benchmark(fn, times, name){
e
=
fn
.
lastIndexOf
(
'}'
);
e
=
fn
.
lastIndexOf
(
'}'
);
fn
=
fn
.
substring
(
s
,
e
);
fn
=
fn
.
substring
(
s
,
e
);
return
benchmarkString
(
fn
,
times
,
name
);
return
benchmarkString
(
fn
,
times
,
name
);
}
}
function
benchmarkString
(
fn
,
times
,
name
)
{
function
benchmarkString
(
fn
,
times
,
name
)
{
var
fn
=
new
Function
(
"i"
,
"var t=new Date; while(i--) {"
+
fn
+
"}; return new Date - t"
)(
times
)
var
fn
=
new
Function
(
"i"
,
"var t=new Date; while(i--) {"
+
fn
+
"}; return new Date - t"
)(
times
)
fn
.
displayName
=
name
||
"benchmarked"
;
fn
.
displayName
=
name
||
"benchmarked"
;
return
fn
;
return
fn
;
}
}
speed/benchmarker.css
View file @
f1dcaad0
.dialog
{
.dialog
{
margin-bottom
:
1em
;
margin-bottom
:
1em
;
}
}
a
.expand
{
a
.expand
{
background
:
#e3e3e3
;
background
:
#e3e3e3
;
}
}
div
#time-test
{
div
#time-test
{
font-family
:
Arial
,
Helvetica
,
sans-serif
;
font-family
:
Arial
,
Helvetica
,
sans-serif
;
...
@@ -42,14 +42,14 @@
...
@@ -42,14 +42,14 @@
text-align
:
center
;
text-align
:
center
;
}
}
#time-test
{
#time-test
{
margin
:
1em
0
;
margin
:
1em
0
;
padding
:
.5em
;
padding
:
.5em
;
background
:
#e3e3e3
;
background
:
#e3e3e3
;
}
}
#time-taken
{
#time-taken
{
font-weight
:
bold
;
font-weight
:
bold
;
}
}
span
.wins
{
span
.wins
{
color
:
#330
;
color
:
#330
;
...
@@ -62,4 +62,4 @@
...
@@ -62,4 +62,4 @@
div
.buttons
{
div
.buttons
{
margin-top
:
10px
;
margin-top
:
10px
;
margin-bottom
:
10px
;
margin-bottom
:
10px
;
}
}
\ No newline at end of file
speed/benchmarker.js
View file @
f1dcaad0
jQuery
.
benchmarker
.
tests
=
[
jQuery
.
benchmarker
.
tests
=
[
// Selectors from:
// Selectors from:
// http://ejohn.org/blog/selectors-that-people-actually-use/
// http://ejohn.org/blog/selectors-that-people-actually-use/
/*
/*
// For Amazon.com
// For Amazon.com
"#navAmazonLogo", "#navSwmSkedPop",
"#navAmazonLogo", "#navSwmSkedPop",
".navbar", ".navGreeting",
".navbar", ".navGreeting",
"div", "table",
"div", "table",
"img.navCrossshopTabCap", "span.navGreeting",
"img.navCrossshopTabCap", "span.navGreeting",
"#navbar table", "#navidWelcomeMsg span",
"#navbar table", "#navidWelcomeMsg span",
"div#navbar", "ul#navAmazonLogo",
"div#navbar", "ul#navAmazonLogo",
"#navAmazonLogo .navAmazonLogoGatewayPanel", "#navidWelcomeMsg .navGreeting",
"#navAmazonLogo .navAmazonLogoGatewayPanel", "#navidWelcomeMsg .navGreeting",
".navbar .navAmazonLogoGatewayPanel", ".navbar .navGreeting",
".navbar .navAmazonLogoGatewayPanel", ".navbar .navGreeting",
"*",
"*",
"#navAmazonLogo li.navAmazonLogoGatewayPanel", "#navidWelcomeMsg span.navGreeting",
"#navAmazonLogo li.navAmazonLogoGatewayPanel", "#navidWelcomeMsg span.navGreeting",
"a[name=top]", "form[name=site-search]",
"a[name=top]", "form[name=site-search]",
".navbar li", ".navbar span",
".navbar li", ".navbar span",
"[name=top]", "[name=site-search]",
"[name=top]", "[name=site-search]",
"ul li", "a img",
"ul li", "a img",
"#navbar #navidWelcomeMsg", "#navbar #navSwmDWPop",
"#navbar #navidWelcomeMsg", "#navbar #navSwmDWPop",
"#navbar ul li", "#navbar a img"
"#navbar ul li", "#navbar a img"
*/
*/
// For Yahoo.com
// For Yahoo.com
"#page"
,
"#masthead"
,
"#mastheadhd"
,
"#page"
,
"#masthead"
,
"#mastheadhd"
,
".mastheadbd"
,
".first"
,
".on"
,
".mastheadbd"
,
".first"
,
".on"
,
"div"
,
"li"
,
"a"
,
"div"
,
"li"
,
"a"
,
"div.mastheadbd"
,
"li.first"
,
"li.on"
,
"div.mastheadbd"
,
"li.first"
,
"li.on"
,
"#page div"
,
"#dtba span"
,
"#page div"
,
"#dtba span"
,
"div#page"
,
"div#masthead"
,
"div#page"
,
"div#masthead"
,
"#page .mastheadbd"
,
"#page .first"
,
"#page .mastheadbd"
,
"#page .first"
,
".outer_search_container .search_container"
,
".searchbox_container .inputtext"
,
".outer_search_container .search_container"
,
".searchbox_container .inputtext"
,
"*"
,
"*"
,
"#page div.mastheadbd"
,
"#page li.first"
,
"#page div.mastheadbd"
,
"#page li.first"
,
"input[name=p]"
,
"a[name=marketplace]"
,
"input[name=p]"
,
"a[name=marketplace]"
,
".outer_search_container div"
,
".searchbox_container span"
,
".outer_search_container div"
,
".searchbox_container span"
,
"[name=p]"
,
"[name=marketplace]"
,
"[name=p]"
,
"[name=marketplace]"
,
"ul li"
,
"form input"
,
"ul li"
,
"form input"
,
"#page #e2econtent"
,
"#page #e2e"
"#page #e2econtent"
,
"#page #e2e"
];
];
jQuery
.
fn
.
benchmark
=
function
()
{
jQuery
.
fn
.
benchmark
=
function
()
{
...
@@ -110,7 +110,7 @@
...
@@ -110,7 +110,7 @@
timeArr
.
push
(
new
Date
()
-
time
);
timeArr
.
push
(
new
Date
()
-
time
);
}
}
var
diff
=
Math
.
sum
(
timeArr
)
-
Math
.
max
.
apply
(
Math
,
timeArr
)
var
diff
=
Math
.
sum
(
timeArr
)
-
Math
.
max
.
apply
(
Math
,
timeArr
)
-
Math
.
min
.
apply
(
Math
,
timeArr
);
-
Math
.
min
.
apply
(
Math
,
timeArr
);
try
{
try
{
var
libRes
=
window
[
libraries
[
0
]](
code
);
var
libRes
=
window
[
libraries
[
0
]](
code
);
var
jqRes
=
jQuery
(
code
);
var
jqRes
=
jQuery
(
code
);
...
...
speed/closest.html
View file @
f1dcaad0
...
@@ -6,34 +6,34 @@
...
@@ -6,34 +6,34 @@
<script
src=
"jquery-basis.js"
></script>
<script
src=
"jquery-basis.js"
></script>
<script>
var
old
=
jQuery
.
noConflict
(
true
);
</script>
<script>
var
old
=
jQuery
.
noConflict
(
true
);
</script>
<script
src=
"../dist/jquery.js"
></script>
<script
src=
"../dist/jquery.js"
></script>
<script>
<script>
jQuery
(
function
ready
()
{
jQuery
(
function
ready
()
{
var
node
=
$
(
"#child"
),
name
;
var
node
=
$
(
"#child"
),
name
;
jQuery
.
each
([
".zoo"
,
"#zoo"
,
"[data-foo=zoo]"
,
"#nonexistant"
],
function
(
i
,
item
)
{
jQuery
.
each
([
".zoo"
,
"#zoo"
,
"[data-foo=zoo]"
,
"#nonexistant"
],
function
(
i
,
item
)
{
setTimeout
(
function
(){
setTimeout
(
function
(){
name
=
"closest '"
+
item
+
"'"
;
name
=
"closest '"
+
item
+
"'"
;
jQuery
(
"#results"
).
append
(
"<li>"
+
name
+
"<ul>"
+
jQuery
(
"#results"
).
append
(
"<li>"
+
name
+
"<ul>"
+
"<li>new: "
+
benchmarkString
(
"$('#child').closest('"
+
item
+
"')"
,
2500
,
name
)
+
"</li>"
+
"<li>new: "
+
benchmarkString
(
"$('#child').closest('"
+
item
+
"')"
,
2500
,
name
)
+
"</li>"
+
"<li>old: "
+
benchmarkString
(
"old('#child').closest('"
+
item
+
"')"
,
2500
,
name
)
+
"</li>"
"<li>old: "
+
benchmarkString
(
"old('#child').closest('"
+
item
+
"')"
,
2500
,
name
)
+
"</li>"
+
"</ul></li>"
);
+
"</ul></li>"
);
},
100
);
},
100
);
});
});
});
});
</script>
</script>
</head>
</head>
<body>
<body>
<div>
<div>
<p>
Hello
</p>
<p>
Hello
</p>
<div
class=
"zoo"
id=
"zoo"
data-foo=
"bar"
>
<div
class=
"zoo"
id=
"zoo"
data-foo=
"bar"
>
<div>
<div>
<p
id=
"child"
>
lorem ipsum
</p>
<p
id=
"child"
>
lorem ipsum
</p>
<p>
dolor sit amet
</p>
<p>
dolor sit amet
</p>
</div>
</div>
</div>
</div>
</div>
</div>
<ul
id=
"results"
></ul>
<ul
id=
"results"
></ul>
</body>
</body>
</html>
</html>
speed/filter.html
View file @
f1dcaad0
This diff is collapsed.
Click to expand it.
speed/find.html
View file @
f1dcaad0
This diff is collapsed.
Click to expand it.
speed/index.html
View file @
f1dcaad0
This diff is collapsed.
Click to expand it.
speed/jquery-basis.js
View file @
f1dcaad0
...
@@ -708,7 +708,7 @@ jQuery.extend({
...
@@ -708,7 +708,7 @@ jQuery.extend({
/
(
opera
)(?:
.*version
)?[
\/]([\w
.
]
+
)
/
.
exec
(
ua
)
||
/
(
opera
)(?:
.*version
)?[
\/]([\w
.
]
+
)
/
.
exec
(
ua
)
||
/
(
msie
)
([\w
.
]
+
)
/
.
exec
(
ua
)
||
/
(
msie
)
([\w
.
]
+
)
/
.
exec
(
ua
)
||
!
/compatible/
.
test
(
ua
)
&&
/
(
mozilla
)(?:
.*
?
rv:
([\w
.
]
+
))?
/
.
exec
(
ua
)
||
!
/compatible/
.
test
(
ua
)
&&
/
(
mozilla
)(?:
.*
?
rv:
([\w
.
]
+
))?
/
.
exec
(
ua
)
||
[];
[];
return
{
browser
:
match
[
1
]
||
""
,
version
:
match
[
2
]
||
"0"
};
return
{
browser
:
match
[
1
]
||
""
,
version
:
match
[
2
]
||
"0"
};
},
},
...
...
test/csp.php
View file @
f1dcaad0
...
@@ -2,10 +2,10 @@
...
@@ -2,10 +2,10 @@
<!DOCTYPE html>
<!DOCTYPE html>
<html>
<html>
<head>
<head>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
/>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
/>
<title>
CSP Test Page
</title>
<title>
CSP Test Page
</title>
<script
src=
"data/include_js.php"
></script>
<script
src=
"data/include_js.php"
></script>
</head>
</head>
<body>
<body>
<p>
CSP Test Page
</p>
<p>
CSP Test Page
</p>
...
...
test/data/etag.php
View file @
f1dcaad0
...
@@ -6,8 +6,8 @@ $etag = md5($ts);
...
@@ -6,8 +6,8 @@ $etag = md5($ts);
$ifNoneMatch
=
isset
(
$_SERVER
[
'HTTP_IF_NONE_MATCH'
])
?
stripslashes
(
$_SERVER
[
'HTTP_IF_NONE_MATCH'
])
:
false
;
$ifNoneMatch
=
isset
(
$_SERVER
[
'HTTP_IF_NONE_MATCH'
])
?
stripslashes
(
$_SERVER
[
'HTTP_IF_NONE_MATCH'
])
:
false
;
if
(
$ifNoneMatch
==
$etag
)
{
if
(
$ifNoneMatch
==
$etag
)
{
header
(
'HTTP/1.0 304 Not Modified'
);
header
(
'HTTP/1.0 304 Not Modified'
);
die
;
// stop processing
die
;
// stop processing
}
}
header
(
"Etag: "
.
$etag
);
header
(
"Etag: "
.
$etag
);
...
...
test/data/event/asyncReady.html
View file @
f1dcaad0
...
@@ -17,7 +17,7 @@ if ( document.attachEvent ) {
...
@@ -17,7 +17,7 @@ if ( document.attachEvent ) {
jQuery
(
"body"
).
append
(
"<div>modifying DOM</div>"
);
jQuery
(
"body"
).
append
(
"<div>modifying DOM</div>"
);
window
.
parent
.
iframeCallback
(
true
);
window
.
parent
.
iframeCallback
(
true
);
});
});
}
}
document
.
getElementsByTagName
(
"head"
)[
0
].
appendChild
(
el
);
document
.
getElementsByTagName
(
"head"
)[
0
].
appendChild
(
el
);
el
.
src
=
"../include_js.php"
;
el
.
src
=
"../include_js.php"
;
},
1000
);
},
1000
);
...
@@ -28,4 +28,4 @@ if ( document.attachEvent ) {
...
@@ -28,4 +28,4 @@ if ( document.attachEvent ) {
<!-- long loading iframe -->
<!-- long loading iframe -->
<iframe
src=
"longLoad.php?sleep=15&return=false"
style=
"width: 1px; height: 1px"
></iframe>
<iframe
src=
"longLoad.php?sleep=15&return=false"
style=
"width: 1px; height: 1px"
></iframe>
</body>
</body>
</html>
</html>
\ No newline at end of file
test/data/if_modified_since.php
View file @
f1dcaad0
...
@@ -5,8 +5,8 @@ $ts = $_REQUEST['ts'];
...
@@ -5,8 +5,8 @@ $ts = $_REQUEST['ts'];
$ifModifiedSince
=
isset
(
$_SERVER
[
'HTTP_IF_MODIFIED_SINCE'
])
?
stripslashes
(
$_SERVER
[
'HTTP_IF_MODIFIED_SINCE'
])
:
false
;
$ifModifiedSince
=
isset
(
$_SERVER
[
'HTTP_IF_MODIFIED_SINCE'
])
?
stripslashes
(
$_SERVER
[
'HTTP_IF_MODIFIED_SINCE'
])
:
false
;
if
(
$ifModifiedSince
==
$ts
)
{
if
(
$ifModifiedSince
==
$ts
)
{
header
(
'HTTP/1.0 304 Not Modified'
);
header
(
'HTTP/1.0 304 Not Modified'
);
die
;
// stop processing
die
;
// stop processing
}
}
header
(
"Last-Modified: "
.
$ts
);
header
(
"Last-Modified: "
.
$ts
);
...
...
test/data/iframe.html
View file @
f1dcaad0
<html>
<html>
<head>
<head>
<title>
iframe
</title>
<title>
iframe
</title>
</head>
</head>
<body>
<body>
<div><span>
span text
</span></div>
<div><span>
span text
</span></div>
</body>
</body>
</html>
</html>
test/delegatetest.html
View file @
f1dcaad0
...
@@ -89,37 +89,37 @@ th, td {
...
@@ -89,37 +89,37 @@ th, td {
</table>
</table>
<p>
NOTE: Only IE supports propertychange, beforeactivate, beforedeactivate; buttons do not support change events.
</p>
<p>
NOTE: Only IE supports propertychange, beforeactivate, beforedeactivate; buttons do not support change events.
</p>
<h2>
Submit Tests
</h2>
<h2>
Submit Tests
</h2>
<table>
<table>
<tr>
<tr>
<td>
<td>
Submit each:
Submit each:
</td>
</td>
<td>
<td>
<form
action=
""
id=
"text_submit"
>
<form
action=
""
id=
"text_submit"
>
<input
class=
'test'
type=
'text'
value=
'Key Return To Submit'
/>
<input
class=
'test'
type=
'text'
value=
'Key Return To Submit'
/>
</form>
</form>
</td>
</td>
<td>
<td>
<form
action=
""
id=
"password_submit"
>
<form
action=
""
id=
"password_submit"
>
<input
class=
'test'
type=
'password'
value=
''
/>
<input
class=
'test'
type=
'password'
value=
''
/>
</form>
</form>
</td>
</td>
<td>
<td>
<form
action=
""
id=
"submit_submit"
>
<form
action=
""
id=
"submit_submit"
>
<input
type=
'submit'
value=
"Click Me To Submit"
/>
<input
type=
'submit'
value=
"Click Me To Submit"
/>
</form>
</form>
</td>
</td>
<td>
$(document).bind('submit')
</td>
<td>
$(document).bind('submit')
</td>
</tr>
</tr>
<tr>
<tr>
<td>
Results:
</td>
<td>
Results:
</td>
<td
id=
'textSubmit'
class=
"red"
>
TEXT
</td>
<td
id=
'textSubmit'
class=
"red"
>
TEXT
</td>
<td
id=
'passwordSubmit'
class=
"red"
>
PASSWORD
</td>
<td
id=
'passwordSubmit'
class=
"red"
>
PASSWORD
</td>
<td
id=
'submitSubmit'
class=
"red"
>
BUTTON
</td>
<td
id=
'submitSubmit'
class=
"red"
>
BUTTON
</td>
<td
id=
'boundSubmit'
class=
"red"
>
DOCUMENT
</td>
<td
id=
'boundSubmit'
class=
"red"
>
DOCUMENT
</td>
</tr>
</tr>
</table>
</table>
<form
id=
"autosub"
><input
type=
submit
name=
subme
/></form>
<form
id=
"autosub"
><input
type=
submit
name=
subme
/></form>
...
...
test/hovertest.html
View file @
f1dcaad0
...
@@ -31,64 +31,64 @@ p {
...
@@ -31,64 +31,64 @@ p {
</style>
</style>
</head>
</head>
<body>
<body>
<h2>
Hover (mouse{over,out,enter,leave}) Tests
</h2>
<h2>
Hover (mouse{over,out,enter,leave}) Tests
</h2>
<p>
Be sure to try moving the mouse out of the browser via the left side on each test.
</p>
<p>
Be sure to try moving the mouse out of the browser via the left side on each test.
</p>
<div
id=
"wrapper"
>
<div
id=
"wrapper"
>
<div
id=
"hoverbox"
class=
"hover-box"
>
<div
id=
"hoverbox"
class=
"hover-box"
>
<div
class=
"hover-status"
>
<div
class=
"hover-status"
>
<button>
Activate
</button>
<button>
Activate
</button>
.hover() in/out:
<span
class=
"ins"
>
0
</span>
/
<span
class=
"outs"
>
0
</span>
.hover() in/out:
<span
class=
"ins"
>
0
</span>
/
<span
class=
"outs"
>
0
</span>
</div>
</div>
<div
class=
"hover-inside"
>
<div
class=
"hover-inside"
>
Mouse over here should NOT trigger the counter.
Mouse over here should NOT trigger the counter.
</div>
</div>
</div>
</div>
<div
id=
"liveenterbox"
class=
"hover-box"
>
<div
id=
"liveenterbox"
class=
"hover-box"
>
<div
class=
"hover-status"
>
<div
class=
"hover-status"
>
<button>
Activate
</button>
<button>
Activate
</button>
Live enter/leave:
<span
class=
"ins"
>
0
</span>
/
<span
class=
"outs"
>
0
</span>
Live enter/leave:
<span
class=
"ins"
>
0
</span>
/
<span
class=
"outs"
>
0
</span>
</div>
</div>
<div
class=
"hover-inside"
>
<div
class=
"hover-inside"
>
Mouse over here should NOT trigger the counter.
Mouse over here should NOT trigger the counter.
</div>
</div>
</div>
</div>
<div
id=
"delegateenterbox"
class=
"hover-box"
>
<div
id=
"delegateenterbox"
class=
"hover-box"
>
<div
class=
"hover-status"
>
<div
class=
"hover-status"
>
<button>
Activate
</button>
<button>
Activate
</button>
Delegated enter/leave:
<span
class=
"ins"
>
0
</span>
/
<span
class=
"outs"
>
0
</span>
Delegated enter/leave:
<span
class=
"ins"
>
0
</span>
/
<span
class=
"outs"
>
0
</span>
</div>
</div>
<div
class=
"hover-inside"
>
<div
class=
"hover-inside"
>
Mouse over here should NOT trigger the counter.
Mouse over here should NOT trigger the counter.
</div>
</div>
</div>
</div>
<div
id=
"overbox"
class=
"hover-box"
>
<div
id=
"overbox"
class=
"hover-box"
>
<div
class=
"hover-status"
>
<div
class=
"hover-status"
>
<button>
Activate
</button>
<button>
Activate
</button>
Bind over/out:
<span
class=
"ins"
>
0
</span>
/
<span
class=
"outs"
>
0
</span>
Bind over/out:
<span
class=
"ins"
>
0
</span>
/
<span
class=
"outs"
>
0
</span>
</div>
</div>
<div
class=
"hover-inside"
>
<div
class=
"hover-inside"
>
Mouse over here SHOULD trigger the counter.
Mouse over here SHOULD trigger the counter.
</div>
</div>
</div>
</div>
<div
id=
"liveoverbox"
class=
"hover-box"
>
<div
id=
"liveoverbox"
class=
"hover-box"
>
<div
class=
"hover-status"
>
<div
class=
"hover-status"
>
<button>
Activate
</button>
<button>
Activate
</button>
Live over/out:
<span
class=
"ins"
>
0
</span>
/
<span
class=
"outs"
>
0
</span>
Live over/out:
<span
class=
"ins"
>
0
</span>
/
<span
class=
"outs"
>
0
</span>
</div>
</div>
<div
class=
"hover-inside"
>
<div
class=
"hover-inside"
>
Mouse over here SHOULD trigger the counter.
Mouse over here SHOULD trigger the counter.
</div>
</div>
</div>
</div>
<div
id=
"delegateoverbox"
class=
"hover-box"
>
<div
id=
"delegateoverbox"
class=
"hover-box"
>
<div
class=
"hover-status"
>
<div
class=
"hover-status"
>
<button>
Activate
</button>
<button>
Activate
</button>
Delegated over/out:
<span
class=
"ins"
>
0
</span>
/
<span
class=
"outs"
>
0
</span>
Delegated over/out:
<span
class=
"ins"
>
0
</span>
/
<span
class=
"outs"
>
0
</span>
</div>
</div>
<div
class=
"hover-inside"
>
<div
class=
"hover-inside"
>
Mouse over here SHOULD trigger the counter.
Mouse over here SHOULD trigger the counter.
</div>
</div>
</div>
</div>
</div>
<!-- wrapper -->
</div>
<!-- wrapper -->
...
...
test/polluted.php
View file @
f1dcaad0
...
@@ -63,7 +63,7 @@
...
@@ -63,7 +63,7 @@
<!DOCTYPE html>
<!DOCTYPE html>
<html>
<html>
<head>
<head>
<meta
http-equiv=
"content-type"
content=
"text/html; charset=UTF-8"
>
<meta
http-equiv=
"content-type"
content=
"text/html; charset=UTF-8"
>
<title>
Run jQuery Test Suite Polluted
</title>
<title>
Run jQuery Test Suite Polluted
</title>
<style
type=
"text/css"
>
<style
type=
"text/css"
>
.otherlibs
fieldset
{
.otherlibs
fieldset
{
...
...
test/unit/ajax.js
View file @
f1dcaad0
This diff is collapsed.
Click to expand it.
test/unit/core.js
View file @
f1dcaad0
...
@@ -1064,13 +1064,13 @@ test("jQuery.proxy", function(){
...
@@ -1064,13 +1064,13 @@ test("jQuery.proxy", function(){
// Make sure it doesn't freak out
// Make sure it doesn't freak out
equal
(
jQuery
.
proxy
(
null
,
thisObject
),
undefined
,
"Make sure no function was returned."
);
equal
(
jQuery
.
proxy
(
null
,
thisObject
),
undefined
,
"Make sure no function was returned."
);
// Partial application
// Partial application
var
test2
=
function
(
a
){
equal
(
a
,
"pre-applied"
,
"Ensure arguments can be pre-applied."
);
};
var
test2
=
function
(
a
){
equal
(
a
,
"pre-applied"
,
"Ensure arguments can be pre-applied."
);
};
jQuery
.
proxy
(
test2
,
null
,
"pre-applied"
)();
jQuery
.
proxy
(
test2
,
null
,
"pre-applied"
)();
// Partial application w/ normal arguments
// Partial application w/ normal arguments
var
test3
=
function
(
a
,
b
){
equal
(
b
,
"normal"
,
"Ensure arguments can be pre-applied and passed as usual."
);
};
var
test3
=
function
(
a
,
b
){
equal
(
b
,
"normal"
,
"Ensure arguments can be pre-applied and passed as usual."
);
};
jQuery
.
proxy
(
test3
,
null
,
"pre-applied"
)(
"normal"
);
jQuery
.
proxy
(
test3
,
null
,
"pre-applied"
)(
"normal"
);
// Test old syntax
// Test old syntax
var
test4
=
{
meth
:
function
(
a
){
equal
(
a
,
"boom"
,
"Ensure old syntax works."
);
}
};
var
test4
=
{
meth
:
function
(
a
){
equal
(
a
,
"boom"
,
"Ensure old syntax works."
);
}
};
...
@@ -1137,52 +1137,52 @@ test("jQuery.parseXML", 8, function(){
...
@@ -1137,52 +1137,52 @@ test("jQuery.parseXML", 8, function(){
});
});
test
(
"jQuery.sub() - Static Methods"
,
function
(){
test
(
"jQuery.sub() - Static Methods"
,
function
(){
expect
(
18
);
expect
(
18
);
var
Subclass
=
jQuery
.
sub
();
var
Subclass
=
jQuery
.
sub
();
Subclass
.
extend
({
Subclass
.
extend
({
topLevelMethod
:
function
()
{
return
this
.
debug
;},
topLevelMethod
:
function
()
{
return
this
.
debug
;},
debug
:
false
,
debug
:
false
,
config
:
{
config
:
{
locale
:
"en_US"
locale
:
"en_US"
},
},
setup
:
function
(
config
)
{
setup
:
function
(
config
)
{
this
.
extend
(
true
,
this
.
config
,
config
);
this
.
extend
(
true
,
this
.
config
,
config
);
}
}
});
});
Subclass
.
fn
.
extend
({
subClassMethod
:
function
()
{
return
this
;}});
Subclass
.
fn
.
extend
({
subClassMethod
:
function
()
{
return
this
;}});
//Test Simple Subclass
//Test Simple Subclass
ok
(
Subclass
.
topLevelMethod
()
===
false
,
"Subclass.topLevelMethod thought debug was true"
);
ok
(
Subclass
.
topLevelMethod
()
===
false
,
"Subclass.topLevelMethod thought debug was true"
);
ok
(
Subclass
.
config
.
locale
==
"en_US"
,
Subclass
.
config
.
locale
+
" is wrong!"
);
ok
(
Subclass
.
config
.
locale
==
"en_US"
,
Subclass
.
config
.
locale
+
" is wrong!"
);
deepEqual
(
Subclass
.
config
.
test
,
undefined
,
"Subclass.config.test is set incorrectly"
);
deepEqual
(
Subclass
.
config
.
test
,
undefined
,
"Subclass.config.test is set incorrectly"
);
equal
(
jQuery
.
ajax
,
Subclass
.
ajax
,
"The subclass failed to get all top level methods"
);
equal
(
jQuery
.
ajax
,
Subclass
.
ajax
,
"The subclass failed to get all top level methods"
);
//Create a SubSubclass
//Create a SubSubclass
var
SubSubclass
=
Subclass
.
sub
();
var
SubSubclass
=
Subclass
.
sub
();
//Make Sure the SubSubclass inherited properly
//Make Sure the SubSubclass inherited properly
ok
(
SubSubclass
.
topLevelMethod
()
===
false
,
"SubSubclass.topLevelMethod thought debug was true"
);
ok
(
SubSubclass
.
topLevelMethod
()
===
false
,
"SubSubclass.topLevelMethod thought debug was true"
);
ok
(
SubSubclass
.
config
.
locale
==
"en_US"
,
SubSubclass
.
config
.
locale
+
" is wrong!"
);
ok
(
SubSubclass
.
config
.
locale
==
"en_US"
,
SubSubclass
.
config
.
locale
+
" is wrong!"
);
deepEqual
(
SubSubclass
.
config
.
test
,
undefined
,
"SubSubclass.config.test is set incorrectly"
);
deepEqual
(
SubSubclass
.
config
.
test
,
undefined
,
"SubSubclass.config.test is set incorrectly"
);
equal
(
jQuery
.
ajax
,
SubSubclass
.
ajax
,
"The subsubclass failed to get all top level methods"
);
equal
(
jQuery
.
ajax
,
SubSubclass
.
ajax
,
"The subsubclass failed to get all top level methods"
);
//Modify The Subclass and test the Modifications
//Modify The Subclass and test the Modifications
SubSubclass
.
fn
.
extend
({
subSubClassMethod
:
function
()
{
return
this
;}});
SubSubclass
.
fn
.
extend
({
subSubClassMethod
:
function
()
{
return
this
;}});
SubSubclass
.
setup
({
locale
:
"es_MX"
,
test
:
"worked"
});
SubSubclass
.
setup
({
locale
:
"es_MX"
,
test
:
"worked"
});
SubSubclass
.
debug
=
true
;
SubSubclass
.
debug
=
true
;
SubSubclass
.
ajax
=
function
()
{
return
false
;};
SubSubclass
.
ajax
=
function
()
{
return
false
;};
ok
(
SubSubclass
.
topLevelMethod
(),
"SubSubclass.topLevelMethod thought debug was false"
);
ok
(
SubSubclass
.
topLevelMethod
(),
"SubSubclass.topLevelMethod thought debug was false"
);
deepEqual
(
SubSubclass
(
document
).
subClassMethod
,
Subclass
.
fn
.
subClassMethod
,
"Methods Differ!"
);
deepEqual
(
SubSubclass
(
document
).
subClassMethod
,
Subclass
.
fn
.
subClassMethod
,
"Methods Differ!"
);
ok
(
SubSubclass
.
config
.
locale
==
"es_MX"
,
SubSubclass
.
config
.
locale
+
" is wrong!"
);
ok
(
SubSubclass
.
config
.
locale
==
"es_MX"
,
SubSubclass
.
config
.
locale
+
" is wrong!"
);
ok
(
SubSubclass
.
config
.
test
==
"worked"
,
"SubSubclass.config.test is set incorrectly"
);
ok
(
SubSubclass
.
config
.
test
==
"worked"
,
"SubSubclass.config.test is set incorrectly"
);
notEqual
(
jQuery
.
ajax
,
SubSubclass
.
ajax
,
"The subsubclass failed to get all top level methods"
);
notEqual
(
jQuery
.
ajax
,
SubSubclass
.
ajax
,
"The subsubclass failed to get all top level methods"
);
//This shows that the modifications to the SubSubClass did not bubble back up to it's superclass
//This shows that the modifications to the SubSubClass did not bubble back up to it's superclass
ok
(
Subclass
.
topLevelMethod
()
===
false
,
"Subclass.topLevelMethod thought debug was true"
);
ok
(
Subclass
.
topLevelMethod
()
===
false
,
"Subclass.topLevelMethod thought debug was true"
);
ok
(
Subclass
.
config
.
locale
==
"en_US"
,
Subclass
.
config
.
locale
+
" is wrong!"
);
ok
(
Subclass
.
config
.
locale
==
"en_US"
,
Subclass
.
config
.
locale
+
" is wrong!"
);
deepEqual
(
Subclass
.
config
.
test
,
undefined
,
"Subclass.config.test is set incorrectly"
);
deepEqual
(
Subclass
.
config
.
test
,
undefined
,
"Subclass.config.test is set incorrectly"
);
deepEqual
(
Subclass
(
document
).
subSubClassMethod
,
undefined
,
"subSubClassMethod set incorrectly"
);
deepEqual
(
Subclass
(
document
).
subSubClassMethod
,
undefined
,
"subSubClassMethod set incorrectly"
);
equal
(
jQuery
.
ajax
,
Subclass
.
ajax
,
"The subclass failed to get all top level methods"
);
equal
(
jQuery
.
ajax
,
Subclass
.
ajax
,
"The subclass failed to get all top level methods"
);
});
});
test
(
"jQuery.sub() - .fn Methods"
,
function
(){
test
(
"jQuery.sub() - .fn Methods"
,
function
(){
...
...
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