#5816 closed bug (fixed)
mouseover event gets fired when the day of today = the set day of the calendar
Reported by: | gaby | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.11.0 |
Component: | ui.datepicker | Version: | 1.8.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
It seems that under the following conditions
- moving from any month to the month of today
- the day of the set date (selected) is the same as the today day
mouseover event gets fired on the today table cell.
To reproduce
Html
<div id="datepicker"></div>
Javascript
$(document).ready(function(){ $('#datepicker').datepicker(); $('#datepicker').datepicker('setDate','+1m'); $('.ui-datepicker-today').live('mouseenter', function(){alert('entered');}); });
Behaviour
Go to previous month
Change History (6)
comment:1 Changed 12 years ago by
comment:2 Changed 10 years ago by
Milestone: | TBD → 1.11.0 |
---|
comment:3 Changed 10 years ago by
Status: | new → open |
---|
Please present in latest: http://jsfiddle.net/fyv33/549/ confirmed.
comment:4 Changed 10 years ago by
Two things to notice:
(a) about the testcase
If we replace .live
for .on
, we don't get the alerts anymore. Is it a .live
thing? http://jsfiddle.net/yb2FR/1/
(b) about inst.dpDiv.find("." + this._dayOverClass + " a").mouseover();
The first commit that introduced the mouseover trigger was 3522a23 --- side note, the short form it has now was due to 74d195e. Apparently, it addressed 3647. Although, this specific change seemed only to be a handy (yet unfortunate) way to avoid repeating code.
The two lines ran by the trigger (in the previous days and still today) are [1] and [2] below. The 1 has no effect, since such element has no ".ui-state-hover" class on creation anyway. The 2 adds ".ui-state-hover" to the target selector. But it gets removed later.
1: $(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"); 2: $(this).addClass("ui-state-hover");
Unless I'm also missing something, we could safely remove the mouseover trigger.
comment:5 Changed 9 years ago by
Resolution: | → fixed |
---|---|
Status: | open → closed |
Datepicker: Remove unnecessary mouseover trigger
Fixes #5816 Closes gh-974
Changeset: f0b4967388a5f0d7eb14c4b124886a11f4aa7d9e
comment:6 Changed 9 years ago by
Datepicker: Abstract mouseover logic to avoid explicit event trigger
The reliance on .mouseover()
caused an issue in some circumstances
(see #5816). The removal of .mouseover()
broke keyboard navigation
(see #10319).
Fixes #10319 Closes gh-1290
Changeset: c399f1f77a015d4f269e3bda98720ebea9bb0c7a
this bug still exists in 1.8.6. I'm not too familiar with the jquery source but I've tracked it to line 7999:
From what I can tell, at least for my own project, there is no adverse effects from removing this line but I do not see any reason why you need mouseover event here at all. But this does cause an unplanned mouseover trigger when "today" is bound to an mouseover/mouseenter event.