Skip to content

Commit 0373146

Browse files
dtaipovholtkamp
authored andcommitted
jQuery 1.3.2 support. Issue #288 (#291)
Moved events binding for days and week number elements to showMonth() function - the place where the elements are added to the DOM. This code tested and works with jquery-1.3.2 and jquery-1.12.2.
1 parent 7af9be4 commit 0373146

File tree

1 file changed

+23
-22
lines changed

1 file changed

+23
-22
lines changed

src/jquery.daterangepicker.js

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -931,13 +931,6 @@
931931

932932
box = createDom().hide();
933933
box.append('<div class="date-range-length-tip"></div>');
934-
box.delegate('.day', 'mouseleave', function()
935-
{
936-
box.find('.date-range-length-tip').hide();
937-
if (opt.singleDate) {
938-
clearHovering();
939-
}
940-
});
941934

942935
$(opt.container).append(box);
943936

@@ -1072,21 +1065,6 @@
10721065
showSelectedDays();
10731066
}
10741067

1075-
box.delegate('.day','click', function(evt)
1076-
{
1077-
dayClicked($(this));
1078-
});
1079-
1080-
box.delegate('.day','mouseenter',function(evt)
1081-
{
1082-
dayHovering($(this));
1083-
});
1084-
1085-
box.delegate('.week-number', 'click', function(evt)
1086-
{
1087-
weekNumberClicked($(this));
1088-
});
1089-
10901068
box.attr('unselectable', 'on')
10911069
.css('user-select', 'none')
10921070
.bind('selectstart', function(e)
@@ -2003,6 +1981,29 @@
20031981
box.find('.'+month+' tbody').html(createMonthHTML(date));
20041982
opt[month] = date;
20051983
updateSelectableRange();
1984+
bindDayEvents();
1985+
}
1986+
1987+
function bindDayEvents()
1988+
{
1989+
box.find('.day').unbind("click").click(function (evt) {
1990+
dayClicked($(this));
1991+
});
1992+
1993+
box.find('.day').unbind("mouseenter").mouseenter(function (evt) {
1994+
dayHovering($(this));
1995+
});
1996+
1997+
box.find('.day').unbind("mouseleave").mouseleave(function (evt) {
1998+
box.find('.date-range-length-tip').hide();
1999+
if (opt.singleDate) {
2000+
clearHovering();
2001+
}
2002+
});
2003+
2004+
box.find('.week-number').unbind("click").click(function (evt) {
2005+
weekNumberClicked($(this));
2006+
});
20062007
}
20072008

20082009
function showTime(date,name)

0 commit comments

Comments
 (0)