Skip to content

Commit c81bfb9

Browse files
committed
Datepicker: show inline datepicker setting explicit display:block instead of using .show() in case it is disconnected. Fixed #7552 - A Datepicker created on a detached div has zero height
(cherry picked from commit b8af0d1)
1 parent ab3b78e commit c81bfb9

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<title>Datepicker Visual Test : Datepicker ticket #7552</title>
6+
<link rel="stylesheet" href="../visual.css" type="text/css" />
7+
<link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css" type="text/css">
8+
<script type="text/javascript" src="../../../jquery-1.5.1.js"></script>
9+
<script type="text/javascript" src="../../../ui/jquery.ui.core.js"></script>
10+
<script type="text/javascript" src="../../../ui/jquery.ui.widget.js"></script>
11+
<script type="text/javascript" src="../../../ui/jquery.ui.datepicker.js"></script>
12+
<script type="text/javascript">
13+
$(function() {
14+
$('<div></div>').datepicker().appendTo("body");
15+
});
16+
</script>
17+
</head>
18+
<body>
19+
20+
<h1 class="ui-widget-header"><a href="http://dev.jqueryui.com/ticket/7552">#7552 - A Datepicker created on a detached div has zero height</a></h1>
21+
22+
</body>
23+
</html>

ui/jquery.ui.datepicker.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,9 @@ $.extend(Datepicker.prototype, {
285285
if( inst.settings.disabled ) {
286286
this._disableDatepicker( target );
287287
}
288-
inst.dpDiv.show();
288+
// Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements
289+
// http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height
290+
inst.dpDiv.css( "display", "block" );
289291
},
290292

291293
/* Pop-up the date picker in a "dialog" box.

0 commit comments

Comments
 (0)