Pad*_*ddy 6 jquery internet-explorer jquery-ui
我最近在IE中遇到了一个问题,使用了jQuery UI datepicker脚本:
加载一个带有日期选择器的页面,显示年份和月份下拉列表.
选择一个日期(这在第一次工作正常).
再次打开日期选择器,但这一次,当您单击其中一个年/月下拉列表时,它会短暂显示然后消失,需要再次单击才能使其正确显示.
我有一个小测试页面(见下文),并使用jQuery 1.4.4和jQuery UI 1.8.10(我的生产配置)和jQuery 1.5.2和jQuery UI 1.8.12进行了测试,并且能够在两种情况下重现它(使用IE9和IE6).
<head>
<script type="text/javascript">
$(document).ready(function () {
$("#testDate").datepicker({changeYear:true,
changeMonth:true,
constrainInput:true,
buttonText:'Choose',
showOn:'both',
showButtonPanel:false,
buttonImageOnly:true});
});
</script>
</head>
<body>
<h2>Test</h2>
<input type="text" id="testDate" />
</body>
Run Code Online (Sandbox Code Playgroud)
我一直试图通过缩小的脚本进行调试,我必须看看这种情况发生了什么,但我有点不知所措......
如果您查看此处未缩小的源代码(1.8.12),则有问题的函数是这样的:
/* Restore input focus after not changing month/year. */
_clickMonthYear: function(id) {
var target = $(id);
var inst = this._getInst(target[0]);
if (inst.input && inst._selectingMonthYear) {
setTimeout(function() {
inst.input.focus();
}, 0);
}
inst._selectingMonthYear = !inst._selectingMonthYear;
},
Run Code Online (Sandbox Code Playgroud)
对我来说,删除setTimeout()呼叫可以解决 IE6 中的聚焦问题。但不确定副作用可能是什么。我用本地修改的 jquery-ui 选择了一些日期,它似乎在 Chrome12 和 IE6 中仍然可以正常工作。可能是 jquery-ui 团队的一个?
编辑找到了错误报告- 看起来它计划在 1.8.3 中发布
| 归档时间: |
|
| 查看次数: |
4404 次 |
| 最近记录: |