Bug Tracker

Ticket #2311 (closed bug: worksforme)

Opened 7 years ago

Last modified 5 years ago

$('body').show() doesn't work

Reported by: larmelarme Owned by:
Priority: minor Milestone:
Component: core Version: 1.2.2
Keywords: Cc:
Blocking: Blocked by:

Description

This code doesn't work on 1.2.2 and 1.2.3.

<html>
<head>
<style>
.none { display: none }
</style>
<script type="text/javascript" src="jquery-1.2.2.js"></script>
<script type="text/javascript">
$(function(){
  $('body').show();
});
</script>
</head>
<body class="none">
This isn't show.
</body>
</html>

I made simple patch.

	show: function(speed,callback){
		return speed ?
			this.animate({
				height: "show", width: "show", opacity: "show"
			}, speed, callback) :
			
			this.filter(":hidden").each(function(){
				this.style.display = this.oldblock || "";
				if ( jQuery.css(this,"display") == "none" ) {
				  var isbody = /^body$/i.test(this.tagName);
					var elem = (isbody) ? $(this) : jQuery("<" + this.tagName + " />").appendTo("body");
					this.style.display = elem.css("display");
					// handle an edge condition where css is - div { display:none; } or similar
					if (this.style.display == "none")
						this.style.display = "block";
					if (!isbody)
						 elem.remove();
				}
			}).end();
	},

Change History

comment:1 Changed 6 years ago by Nodashi

I think you should execute your show statement in the ready function

comment:2 Changed 5 years ago by petersendidit

This is working correctly in 1.4.1

comment:3 Changed 5 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to worksforme
Note: See TracTickets for help on using tickets.