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
f576ceee
Commit
f576ceee
authored
Dec 04, 2007
by
Brandon Aaron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Beginnings of the offset test suite
parent
76e3a901
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
136 additions
and
0 deletions
+136
-0
absolute.html
test/data/offset/absolute.html
+26
-0
relative.html
test/data/offset/relative.html
+32
-0
offset.html
test/offset.html
+27
-0
offset.js
test/unit/offset.js
+51
-0
No files found.
test/data/offset/absolute.html
0 → 100644
View file @
f576ceee
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta
http-equiv=
"Content-type"
content=
"text/html; charset=utf-8"
>
<title>
absolute
</title>
<style
type=
"text/css"
media=
"screen"
>
body
{
margin
:
1px
;
padding
:
5px
;
}
div
.absolute
{
position
:
absolute
;
margin
:
1px
;
border
:
2px
solid
#000
;
padding
:
5px
;
width
:
100px
;
height
:
100px
;
}
#absolute-1
{
top
:
0
;
left
:
0
;
}
#absolute-1-1
{
top
:
1px
;
left
:
1px
;
}
#absolute-1-1-1
{
top
:
1px
;
left
:
1px
;
}
#absolute-2
{
top
:
19px
;
left
:
19px
;
}
</style>
<script
type=
"text/javascript"
src=
"../../../dist/jquery.js"
></script>
<script
type=
"text/javascript"
charset=
"utf-8"
>
$
(
function
()
{
return
;
});
</script>
</head>
<body>
<div
id=
"absolute-1"
class=
"absolute"
>
absolute-1
<div
id=
"absolute-1-1"
class=
"absolute"
>
absolute-1-1
<div
id=
"absolute-1-1-1"
class=
"absolute"
>
absolute-1-1-1
</div>
</div>
</div>
<div
id=
"absolute-2"
class=
"absolute"
>
absolute-2
</div>
</body>
</html>
\ No newline at end of file
test/data/offset/relative.html
0 → 100644
View file @
f576ceee
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta
http-equiv=
"Content-type"
content=
"text/html; charset=utf-8"
>
<title>
relative
</title>
<style
type=
"text/css"
media=
"screen"
>
body
{
margin
:
1px
;
padding
:
5px
;
}
div
.relative
{
position
:
relative
;
margin
:
1px
;
border
:
2px
solid
#000
;
padding
:
5px
;
width
:
100px
;
height
:
100px
;
background
:
#fff
;
overflow
:
hidden
;
}
#relative-2
{
top
:
20px
;
left
:
20px
;
}
#marker
{
position
:
absolute
;
border
:
2px
solid
#000
;
width
:
50px
;
height
:
50px
;
background
:
#ccc
;
}
</style>
<script
type=
"text/javascript"
src=
"../../../dist/jquery.js"
></script>
<script
type=
"text/javascript"
charset=
"utf-8"
>
$
(
function
()
{
$
(
'.relative'
).
click
(
function
()
{
$
(
'#marker'
).
css
(
$
(
this
).
offset
()
);
return
false
;
});
});
</script>
</head>
<body>
<div
id=
"relative-1"
class=
"relative"
>
relative-1
<div
id=
"relative-1-1"
class=
"relative"
>
relative-1-1
<div
id=
"relative-1-1-1"
class=
"relative"
>
relative-1-1-1
</div>
</div>
</div>
<div
id=
"relative-2"
class=
"relative"
>
relative-2
</div>
<div
id=
"marker"
></div>
</body>
</html>
\ No newline at end of file
test/offset.html
0 → 100644
View file @
f576ceee
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns=
"http://www.w3.org/1999/xhtml"
xml:lang=
"en"
lang=
"en"
dir=
"ltr"
id=
"html"
>
<head>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
/>
<title>
jQuery Offset Test Suite
</title>
<link
rel=
"Stylesheet"
media=
"screen"
href=
"data/testsuite.css"
/>
<script
type=
"text/javascript"
src=
"../dist/jquery.js"
></script>
<script
type=
"text/javascript"
src=
"data/testrunner.js"
></script>
<script
type=
"text/javascript"
src=
"unit/offset.js"
></script>
</head>
<body
id=
"body"
>
<h1
id=
"header"
>
jQuery Offset Test Suite
</h1>
<h2
id=
"banner"
></h2>
<h2
id=
"userAgent"
></h2>
<!-- Test HTML -->
<div
id=
"nothiddendiv"
style=
"height:1px;background:white;"
></div>
<dl
id=
"dl"
style=
"display:none;"
>
<div
id=
"main"
style=
"display: none;"
>
</div>
</dl>
<ol
id=
"tests"
></ol>
</body>
</html>
test/unit/offset.js
0 → 100644
View file @
f576ceee
module
(
"offset"
);
// opens a new window to run the tests against
var
testwin
=
function
(
name
,
fn
)
{
testwin
[
name
]
=
load_offset_fixture
(
name
);
var
interval
=
setInterval
(
function
()
{
if
(
testwin
[
name
]
&&
testwin
[
name
].
$
&&
testwin
[
name
].
$
.
isReady
)
{
clearInterval
(
interval
);
test
(
name
,
fn
);
}
},
0
);
function
load_offset_fixture
(
name
)
{
var
win
=
window
.
open
(
"./data/offset/"
+
name
+
".html?num"
+
parseInt
(
Math
.
random
()
*
1000
),
name
,
'left=0,top=0,width=500,height=500,toolbar=1,resizable=0'
);
if
(
!
win
)
{
alert
(
"Please disable your popup blocker for the offset test suite"
);
throw
"Please disable your popup blocker for the offset test suite"
;
}
return
win
;
}
};
testwin
(
"absolute"
,
function
()
{
var
$w
=
testwin
[
"absolute"
].
$
;
equals
(
$w
(
'#absolute-1'
).
offset
().
top
,
1
,
"$('#absolute-1').offset().top"
);
equals
(
$w
(
'#absolute-1'
).
offset
().
left
,
1
,
"$('#absolute-1').offset().left"
);
equals
(
$w
(
'#absolute-1-1'
).
offset
().
top
,
5
,
"$('#absolute-1-1').offset().top"
);
equals
(
$w
(
'#absolute-1-1'
).
offset
().
left
,
5
,
"$('#absolute-1-1').offset().left"
);
equals
(
$w
(
'#absolute-1-1-1'
).
offset
().
top
,
9
,
"$('#absolute-1-1-1').offset().top"
);
equals
(
$w
(
'#absolute-1-1-1'
).
offset
().
left
,
9
,
"$('#absolute-1-1-1').offset().left"
);
equals
(
$w
(
'#absolute-2'
).
offset
().
top
,
20
,
"$('#absolute-2').offset().top"
);
equals
(
$w
(
'#absolute-2'
).
offset
().
left
,
20
,
"$('#absolute-2').offset().left"
);
testwin
[
"absolute"
].
close
();
});
testwin
(
"relative"
,
function
()
{
var
$w
=
testwin
[
"relative"
].
$
;
equals
(
$w
(
'#relative-1'
).
offset
().
top
,
jQuery
.
browser
.
msie
?
6
:
7
,
"$('#relative-1').offset().top"
);
equals
(
$w
(
'#relative-1'
).
offset
().
left
,
7
,
"$('#relative-1').offset().left"
);
equals
(
$w
(
'#relative-2'
).
offset
().
top
,
jQuery
.
browser
.
msie
?
141
:
142
,
"$('#relative-2').offset().top"
);
equals
(
$w
(
'#relative-2'
).
offset
().
left
,
27
,
"$('#relative-2').offset().left"
);
testwin
[
"relative"
].
close
();
});
\ 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