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
1eedf0e9
Commit
1eedf0e9
authored
Nov 11, 2014
by
Oleg Gaidarenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dimensions: allow modification of coordinates argument
Ref f7e60dc83d81cbf892de9dab39642dd67c49bd23
parent
38ac3c43
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
1 deletion
+15
-1
offset.js
src/offset.js
+3
-1
dimensions.js
test/unit/dimensions.js
+12
-0
No files found.
src/offset.js
View file @
1eedf0e9
...
@@ -57,7 +57,9 @@ jQuery.offset = {
...
@@ -57,7 +57,9 @@ jQuery.offset = {
}
}
if
(
jQuery
.
isFunction
(
options
)
)
{
if
(
jQuery
.
isFunction
(
options
)
)
{
options
=
options
.
call
(
elem
,
i
,
curOffset
);
// Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
options
=
options
.
call
(
elem
,
i
,
jQuery
.
extend
(
{},
curOffset
)
);
}
}
if
(
options
.
top
!=
null
)
{
if
(
options
.
top
!=
null
)
{
...
...
test/unit/dimensions.js
View file @
1eedf0e9
...
@@ -470,4 +470,16 @@ testIframe( "dimensions/documentLarge", "window vs. large document", function( j
...
@@ -470,4 +470,16 @@ testIframe( "dimensions/documentLarge", "window vs. large document", function( j
ok
(
jQuery
(
document
).
width
()
>
jQuery
(
window
).
width
(),
"document width is larger than window width"
);
ok
(
jQuery
(
document
).
width
()
>
jQuery
(
window
).
width
(),
"document width is larger than window width"
);
});
});
test
(
"allow modification of coordinates argument (gh-1848)"
,
1
,
function
()
{
var
element
=
jQuery
(
"<div/>"
).
appendTo
(
"#qunit-fixture"
);
element
.
offset
(
function
(
index
,
coords
)
{
coords
.
top
=
100
;
return
coords
;
});
equal
(
element
.
offset
().
top
,
100
,
"coordinates are modified"
);
});
})();
})();
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