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
890d441a
Commit
890d441a
authored
Mar 20, 2014
by
Richard Gibson
Committed by
Dave Methvin
Mar 21, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Effects: Don't overwrite display:none when .hide()ing hidden elements
Fixes #14848 Closes gh-1548
parent
5a8f7693
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
5 deletions
+23
-5
effects.js
src/effects.js
+10
-5
effects.js
test/unit/effects.js
+13
-0
No files found.
src/effects.js
View file @
890d441a
...
@@ -160,11 +160,8 @@ function defaultPrefilter( elem, props, opts ) {
...
@@ -160,11 +160,8 @@ function defaultPrefilter( elem, props, opts ) {
// Set display property to inline-block for height/width
// Set display property to inline-block for height/width
// animations on inline elements that are having width/height animated
// animations on inline elements that are having width/height animated
display
=
jQuery
.
css
(
elem
,
"display"
);
display
=
jQuery
.
css
(
elem
,
"display"
);
// Get default display if display is currently "none"
// Test default display if display is currently "none"
if
(
display
===
"none"
)
{
if
(
(
display
===
"none"
?
defaultDisplay
(
elem
.
nodeName
)
:
display
)
===
"inline"
&&
display
=
defaultDisplay
(
elem
.
nodeName
);
}
if
(
display
===
"inline"
&&
jQuery
.
css
(
elem
,
"float"
)
===
"none"
)
{
jQuery
.
css
(
elem
,
"float"
)
===
"none"
)
{
style
.
display
=
"inline-block"
;
style
.
display
=
"inline-block"
;
...
@@ -196,6 +193,10 @@ function defaultPrefilter( elem, props, opts ) {
...
@@ -196,6 +193,10 @@ function defaultPrefilter( elem, props, opts ) {
}
}
}
}
orig
[
prop
]
=
dataShow
&&
dataShow
[
prop
]
||
jQuery
.
style
(
elem
,
prop
);
orig
[
prop
]
=
dataShow
&&
dataShow
[
prop
]
||
jQuery
.
style
(
elem
,
prop
);
// Any non-fx value stops us from restoring the original display value
}
else
{
display
=
undefined
;
}
}
}
}
...
@@ -238,6 +239,10 @@ function defaultPrefilter( elem, props, opts ) {
...
@@ -238,6 +239,10 @@ function defaultPrefilter( elem, props, opts ) {
}
}
}
}
}
}
// If this is a noop like .hide().hide(), restore an overwritten display value
}
else
if
(
(
display
===
"none"
?
defaultDisplay
(
elem
.
nodeName
)
:
display
)
===
"inline"
)
{
style
.
display
=
display
;
}
}
}
}
...
...
test/unit/effects.js
View file @
890d441a
...
@@ -1620,6 +1620,19 @@ test( "hide, fadeOut and slideUp called on element width height and width = 0 sh
...
@@ -1620,6 +1620,19 @@ test( "hide, fadeOut and slideUp called on element width height and width = 0 sh
this
.
clock
.
tick
(
400
);
this
.
clock
.
tick
(
400
);
});
});
test
(
"hide should not leave hidden inline elements visible (#14848)"
,
2
,
function
()
{
var
el
=
jQuery
(
"#simon1"
);
el
.
hide
(
1
,
function
()
{
equal
(
el
.
css
(
"display"
),
"none"
,
"hidden"
);
el
.
hide
(
1
,
function
()
{
equal
(
el
.
css
(
"display"
),
"none"
,
"still hidden"
);
});
});
this
.
clock
.
tick
(
100
);
});
test
(
"Handle queue:false promises"
,
10
,
function
()
{
test
(
"Handle queue:false promises"
,
10
,
function
()
{
var
foo
=
jQuery
(
"#foo"
).
clone
().
addBack
(),
var
foo
=
jQuery
(
"#foo"
).
clone
().
addBack
(),
step
=
1
;
step
=
1
;
...
...
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