Search and Top Navigation
#5816 closed bug (fixed)
Opened July 09, 2010 02:57PM UTC
Closed May 02, 2014 03:30PM UTC
Last modified July 23, 2014 07:10PM UTC
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
Attachments (0)
Change History (6)
Changed September 02, 2011 02:11PM UTC by comment:1
Changed October 11, 2012 09:04PM UTC by comment:2
| milestone: | TBD → 1.11.0 |
|---|
Changed October 17, 2012 06:33AM UTC by comment:3
| status: | new → open |
|---|
Please present in latest: http://jsfiddle.net/fyv33/549/ confirmed.
Changed April 30, 2013 06:29PM UTC by comment:4
| _comment0: | 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 trigger mouseover was [https://github.com/jquery/jquery-ui/commit/3522a23#L2R603 3522a23] --- side note, the short form it has now was due to [https://github.com/jquery/jquery-ui/commit/74d195e#L0R684 74d195e]. Apparently, it addressed [http://bugs.jqueryui.com/ticket/3647 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. → 1367346665733609 |
|---|
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.
Changed May 02, 2014 03:30PM UTC by comment:5
| resolution: | → fixed |
|---|---|
| status: | open → closed |
Datepicker: Remove unnecessary mouseover trigger
Fixes #5816
Closes gh-974
Changeset: f0b4967388a5f0d7eb14c4b124886a11f4aa7d9e
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:
if( !!cover.length ){ //avoid call to outerXXXX() when not in IE6 cover.css({left: -borders[0], top: -borders[1], width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()}) } inst.dpDiv.find('.' + this._dayOverClass + ' a').mouseover(); /* the line in question */ var numMonths = this._getNumberOfMonths(inst); var cols = numMonths[1]; var width = 17; inst.dpDiv.removeClass('ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4').width('');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.