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
d5e5ce5b
Commit
d5e5ce5b
authored
May 25, 2012
by
Mike Sherov
Committed by
Dave Methvin
May 25, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #11311. Percents not pixels for top/left/bottom/right. Closes gh-793.
parent
04c06e68
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletion
+10
-1
css.js
src/css.js
+4
-1
css.js
test/unit/css.js
+6
-0
No files found.
src/css.js
View file @
d5e5ce5b
...
...
@@ -16,6 +16,7 @@ var ralpha = /alpha\([^)]*\)/i,
cssExpand
=
jQuery
.
cssExpand
,
cssPrefixes
=
[
"Webkit"
,
"O"
,
"Moz"
,
"ms"
],
rposition
=
/^
(
top|right|bottom|left
)
$/
,
curCSS
;
...
...
@@ -242,7 +243,9 @@ if ( document.defaultView && document.defaultView.getComputedStyle ) {
// If we're not dealing with a regular pixel number
// but a number that has a weird ending, we need to convert it to pixels
if
(
rnumnonpx
.
test
(
ret
)
)
{
// but not position css attributes, as those are proportional to the parent element instead
// and we can't measure the parent instead because it might trigger a "stacking dolls" problem
if
(
rnumnonpx
.
test
(
ret
)
&&
!
rposition
.
test
(
name
)
)
{
// Remember the original values
left
=
style
.
left
;
...
...
test/unit/css.js
View file @
d5e5ce5b
...
...
@@ -538,6 +538,12 @@ test("can't get background-position in IE<9, see #10796", function() {
}
});
test
(
"percentage position properties in IE<9 should not be incorrectly transformed to pixels, see #11311"
,
function
()
{
expect
(
1
);
var
div
=
jQuery
(
"<div style='position: absolute; width: 1px; height: 20px; bottom:50%;'></div>"
).
appendTo
(
"#qunit-fixture"
);
ok
(
window
.
getComputedStyle
||
div
.
css
(
"bottom"
)
===
"50%"
,
"position properties get incorrectly transformed in IE<8, see #11311"
);
});
test
(
"Do not append px to 'fill-opacity' #9548"
,
1
,
function
()
{
var
$div
=
jQuery
(
"<div>"
).
appendTo
(
"#qunit-fixture"
);
...
...
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