aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard D. Worth <rdworth@gmail.com>2011-07-19 07:59:21 -0400
committerRichard D. Worth <rdworth@gmail.com>2011-07-19 07:59:21 -0400
commitb8af0d1f7505dd5e56319a11bbd14f1e381b36b9 (patch)
treedfaf80802fd7d845064ed791f3075042fcc14f05
parent416bc6f9e871c6c0e91b010ba941c33ef19b442b (diff)
downloadjquery-ui-b8af0d1f7505dd5e56319a11bbd14f1e381b36b9.tar.gz
jquery-ui-b8af0d1f7505dd5e56319a11bbd14f1e381b36b9.zip
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
-rw-r--r--tests/visual/datepicker/datepicker_ticket_7552.html23
-rw-r--r--ui/jquery.ui.datepicker.js4
2 files changed, 26 insertions, 1 deletions
diff --git a/tests/visual/datepicker/datepicker_ticket_7552.html b/tests/visual/datepicker/datepicker_ticket_7552.html
new file mode 100644
index 000000000..a78a84818
--- /dev/null
+++ b/tests/visual/datepicker/datepicker_ticket_7552.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8" />
+ <title>Datepicker Visual Test : Datepicker ticket #7552</title>
+ <link rel="stylesheet" href="../visual.css" type="text/css" />
+ <link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css" type="text/css">
+ <script type="text/javascript" src="../../../jquery-1.5.1.js"></script>
+ <script type="text/javascript" src="../../../ui/jquery.ui.core.js"></script>
+ <script type="text/javascript" src="../../../ui/jquery.ui.widget.js"></script>
+ <script type="text/javascript" src="../../../ui/jquery.ui.datepicker.js"></script>
+ <script type="text/javascript">
+ $(function() {
+ $('<div></div>').datepicker().appendTo("body");
+ });
+ </script>
+</head>
+<body>
+
+<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>
+
+</body>
+</html>
diff --git a/ui/jquery.ui.datepicker.js b/ui/jquery.ui.datepicker.js
index aeadde4ee..87f9bd950 100644
--- a/ui/jquery.ui.datepicker.js
+++ b/ui/jquery.ui.datepicker.js
@@ -285,7 +285,9 @@ $.extend(Datepicker.prototype, {
if( inst.settings.disabled ) {
this._disableDatepicker( target );
}
- inst.dpDiv.show();
+ // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements
+ // http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height
+ inst.dpDiv.css( "display", "block" );
},
/* Pop-up the date picker in a "dialog" box.