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
f01ef93a
Commit
f01ef93a
authored
Jan 17, 2011
by
jeresig
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '7608' of
https://github.com/rwldrn/jquery
into rwldrn-7608
parents
987c44be
9bd9d270
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
4 deletions
+30
-4
css.js
src/css.js
+8
-4
css.js
test/unit/css.js
+22
-0
No files found.
src/css.js
View file @
f01ef93a
...
@@ -263,8 +263,9 @@ if ( document.defaultView && document.defaultView.getComputedStyle ) {
...
@@ -263,8 +263,9 @@ if ( document.defaultView && document.defaultView.getComputedStyle ) {
if
(
document
.
documentElement
.
currentStyle
)
{
if
(
document
.
documentElement
.
currentStyle
)
{
currentStyle
=
function
(
elem
,
name
)
{
currentStyle
=
function
(
elem
,
name
)
{
var
left
,
rsLeft
,
var
left
,
ret
=
elem
.
currentStyle
&&
elem
.
currentStyle
[
name
],
ret
=
elem
.
currentStyle
&&
elem
.
currentStyle
[
name
],
rsLeft
=
elem
.
runtimeStyle
&&
elem
.
runtimeStyle
[
name
],
style
=
elem
.
style
;
style
=
elem
.
style
;
// From the awesome hack by Dean Edwards
// From the awesome hack by Dean Edwards
...
@@ -275,17 +276,20 @@ if ( document.documentElement.currentStyle ) {
...
@@ -275,17 +276,20 @@ if ( document.documentElement.currentStyle ) {
if
(
!
rnumpx
.
test
(
ret
)
&&
rnum
.
test
(
ret
)
)
{
if
(
!
rnumpx
.
test
(
ret
)
&&
rnum
.
test
(
ret
)
)
{
// Remember the original values
// Remember the original values
left
=
style
.
left
;
left
=
style
.
left
;
rsLeft
=
elem
.
runtimeStyle
.
left
;
// Put in the new values to get a computed value out
// Put in the new values to get a computed value out
if
(
rsLeft
)
{
elem
.
runtimeStyle
.
left
=
elem
.
currentStyle
.
left
;
elem
.
runtimeStyle
.
left
=
elem
.
currentStyle
.
left
;
}
style
.
left
=
name
===
"fontSize"
?
"1em"
:
(
ret
||
0
);
style
.
left
=
name
===
"fontSize"
?
"1em"
:
(
ret
||
0
);
ret
=
style
.
pixelLeft
+
"px"
;
ret
=
style
.
pixelLeft
+
"px"
;
// Revert the changed values
// Revert the changed values
style
.
left
=
left
;
style
.
left
=
left
;
if
(
rsLeft
)
{
elem
.
runtimeStyle
.
left
=
rsLeft
;
elem
.
runtimeStyle
.
left
=
rsLeft
;
}
}
}
return
ret
===
""
?
"auto"
:
ret
;
return
ret
===
""
?
"auto"
:
ret
;
};
};
...
...
test/unit/css.js
View file @
f01ef93a
...
@@ -320,3 +320,25 @@ test(":visible selector works properly on children with a hidden parent (bug #45
...
@@ -320,3 +320,25 @@ test(":visible selector works properly on children with a hidden parent (bug #45
jQuery
(
'#table'
).
css
(
'display'
,
'none'
).
html
(
'<tr><td>cell</td><td>cell</td></tr>'
);
jQuery
(
'#table'
).
css
(
'display'
,
'none'
).
html
(
'<tr><td>cell</td><td>cell</td></tr>'
);
equals
(
jQuery
(
'#table td:visible'
).
length
,
0
,
"hidden cell children not perceived as visible"
);
equals
(
jQuery
(
'#table td:visible'
).
length
,
0
,
"hidden cell children not perceived as visible"
);
});
});
test
(
"internal ref to elem.runtimeStyle (bug #7608)"
,
function
()
{
expect
(
1
);
var
result
=
true
,
val
=
10
;
jQuery
(
'<div id="bug7608" style="width:200px;border:solid 1px red;">'
+
'<div id="test" style="width:0%; background:#000;"> </div></div>'
).
appendTo
(
"#main"
);
try
{
// the bug is located within src/css.js
jQuery
(
"#bug7608 #test"
).
animate
(
{
width
:
val
},
1000
);
}
catch
(
e
)
{
result
=
false
;
}
ok
(
result
,
"elem.runtimeStyle does not throw exception"
);
jQuery
(
"#bug7608"
).
remove
();
});
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