Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Moved cancelEventPropagation into core.js

The cancelEventPropagation function is a general utility function that
can be reused by other widgets. Refs #4120.
  • Loading branch information...
commit 0a9ea56056ee4a7ded265dc56fff309c906473d1 1 parent d5824ef
@andrewjesaitis andrewjesaitis authored claudep committed
View
9 django/contrib/admin/static/admin/js/admin/DateTimeShortcuts.js
@@ -76,7 +76,7 @@ var DateTimeShortcuts = {
clock_box.className = 'clockbox module';
clock_box.setAttribute('id', DateTimeShortcuts.clockDivName + num);
document.body.appendChild(clock_box);
- addEvent(clock_box, 'click', DateTimeShortcuts.cancelEventPropagation);
+ addEvent(clock_box, 'click', cancelEventPropagation);
quickElement('h2', clock_box, gettext('Choose a time'));
var time_list = quickElement('ul', clock_box, '');
@@ -174,7 +174,7 @@ var DateTimeShortcuts = {
cal_box.className = 'calendarbox module';
cal_box.setAttribute('id', DateTimeShortcuts.calendarDivName1 + num);
document.body.appendChild(cal_box);
- addEvent(cal_box, 'click', DateTimeShortcuts.cancelEventPropagation);
+ addEvent(cal_box, 'click', cancelEventPropagation);
// next-prev links
var cal_nav = quickElement('div', cal_box, '');
@@ -277,11 +277,6 @@ var DateTimeShortcuts = {
DateTimeShortcuts.calendarInputs[num].value = d.strftime(get_format('DATE_INPUT_FORMATS')[0]);
DateTimeShortcuts.calendarInputs[num].focus();
DateTimeShortcuts.dismissCalendar(num);
- },
- cancelEventPropagation: function(e) {
- if (!e) e = window.event;
- e.cancelBubble = true;
- if (e.stopPropagation) e.stopPropagation();
}
}
View
6 django/contrib/admin/static/admin/js/core.js
@@ -29,6 +29,12 @@ function removeEvent(obj, evType, fn) {
}
}
+function cancelEventPropagation(e) {
+ if (!e) e = window.event;
+ e.cancelBubble = true;
+ if (e.stopPropagation) e.stopPropagation();
+}
+
// quickElement(tagType, parentReference, textInChildNode, [, attribute, attributeValue ...]);
function quickElement() {
var obj = document.createElement(arguments[0]);

0 comments on commit 0a9ea56

Please sign in to comment.
Something went wrong with that request. Please try again.