Merge branch 'bug7141' of http://github.com/csnover/jquery into csnover-bug7141
This commit is contained in:
commit
5f30ae3b6f
2 changed files with 34 additions and 3 deletions
7
src/effects.js
vendored
7
src/effects.js
vendored
|
@ -49,9 +49,10 @@ jQuery.fn.extend({
|
|||
|
||||
} else {
|
||||
for ( var i = 0, j = this.length; i < j; i++ ) {
|
||||
var old = jQuery.data(this[i], "olddisplay");
|
||||
if ( !old ) {
|
||||
jQuery.data( this[i], "olddisplay", jQuery.css( this[i], "display" ) );
|
||||
var display = jQuery.css( this[i], "display" );
|
||||
|
||||
if ( display !== "none" ) {
|
||||
jQuery.data( this[i], "olddisplay", display );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
30
test/unit/effects.js
vendored
30
test/unit/effects.js
vendored
|
@ -770,3 +770,33 @@ test("animate with per-property easing", function(){
|
|||
});
|
||||
|
||||
});
|
||||
|
||||
test("hide hidden elements (bug #7141)", function() {
|
||||
expect(3);
|
||||
QUnit.reset();
|
||||
|
||||
var div = jQuery("<div style='display:none'></div>").appendTo("#main");
|
||||
equals( div.css("display"), "none", "Element is hidden by default" );
|
||||
div.hide();
|
||||
ok( !div.data("olddisplay"), "olddisplay is undefined after hiding an already-hidden element" );
|
||||
div.show();
|
||||
equals( div.css("display"), "block", "Show a double-hidden element" );
|
||||
|
||||
div.remove();
|
||||
});
|
||||
|
||||
test("hide hidden elements, with animation (bug #7141)", function() {
|
||||
expect(3);
|
||||
QUnit.reset();
|
||||
stop();
|
||||
|
||||
var div = jQuery("<div style='display:none'></div>").appendTo("#main");
|
||||
equals( div.css("display"), "none", "Element is hidden by default" );
|
||||
div.hide(1, function () {
|
||||
ok( !div.data("olddisplay"), "olddisplay is undefined after hiding an already-hidden element" );
|
||||
div.show(1, function () {
|
||||
equals( div.css("display"), "block", "Show a double-hidden element" );
|
||||
start();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue