mirror of https://github.com/django/django.git
Fixed #21445 -- Clean up misuse of null in quickElement.
Thanks to trac user parsch for the report.
This commit is contained in:
parent
1d2dd3b9fa
commit
3ca0815c0b
|
@ -40,7 +40,7 @@ window.SelectFilter = {
|
|||
selector_div.className = is_stacked ? 'selector stacked' : 'selector';
|
||||
|
||||
// <div class="selector-available">
|
||||
var selector_available = quickElement('div', selector_div, '');
|
||||
var selector_available = quickElement('div', selector_div);
|
||||
selector_available.className = 'selector-available';
|
||||
var title_available = quickElement('h2', selector_available, interpolate(gettext('Available %s') + ' ', [field_name]));
|
||||
quickElement('img', title_available, '', 'src', admin_static_prefix + 'img/icon-unknown.gif', 'width', '10', 'height', '10', 'class', 'help help-tooltip', 'title', interpolate(gettext('This is the list of available %s. You may choose some by selecting them in the box below and then clicking the "Choose" arrow between the two boxes.'), [field_name]));
|
||||
|
@ -62,15 +62,15 @@ window.SelectFilter = {
|
|||
choose_all.className = 'selector-chooseall';
|
||||
|
||||
// <ul class="selector-chooser">
|
||||
var selector_chooser = quickElement('ul', selector_div, '');
|
||||
var selector_chooser = quickElement('ul', selector_div);
|
||||
selector_chooser.className = 'selector-chooser';
|
||||
var add_link = quickElement('a', quickElement('li', selector_chooser, ''), gettext('Choose'), 'title', gettext('Choose'), 'href', 'javascript: (function(){ SelectBox.move("' + field_id + '_from","' + field_id + '_to"); SelectFilter.refresh_icons("' + field_id + '");})()', 'id', field_id + '_add_link');
|
||||
var add_link = quickElement('a', quickElement('li', selector_chooser), gettext('Choose'), 'title', gettext('Choose'), 'href', 'javascript: (function(){ SelectBox.move("' + field_id + '_from","' + field_id + '_to"); SelectFilter.refresh_icons("' + field_id + '");})()', 'id', field_id + '_add_link');
|
||||
add_link.className = 'selector-add';
|
||||
var remove_link = quickElement('a', quickElement('li', selector_chooser, ''), gettext('Remove'), 'title', gettext('Remove'), 'href', 'javascript: (function(){ SelectBox.move("' + field_id + '_to","' + field_id + '_from"); SelectFilter.refresh_icons("' + field_id + '");})()', 'id', field_id + '_remove_link');
|
||||
var remove_link = quickElement('a', quickElement('li', selector_chooser), gettext('Remove'), 'title', gettext('Remove'), 'href', 'javascript: (function(){ SelectBox.move("' + field_id + '_to","' + field_id + '_from"); SelectFilter.refresh_icons("' + field_id + '");})()', 'id', field_id + '_remove_link');
|
||||
remove_link.className = 'selector-remove';
|
||||
|
||||
// <div class="selector-chosen">
|
||||
var selector_chosen = quickElement('div', selector_div, '');
|
||||
var selector_chosen = quickElement('div', selector_div);
|
||||
selector_chosen.className = 'selector-chosen';
|
||||
var title_chosen = quickElement('h2', selector_chosen, interpolate(gettext('Chosen %s') + ' ', [field_name]));
|
||||
quickElement('img', title_chosen, '', 'src', admin_static_prefix + 'img/icon-unknown.gif', 'width', '10', 'height', '10', 'class', 'help help-tooltip', 'title', interpolate(gettext('This is the list of chosen %s. You may remove some by selecting them in the box below and then clicking the "Remove" arrow between the two boxes.'), [field_name]));
|
||||
|
|
|
@ -144,14 +144,14 @@ var DateTimeShortcuts = {
|
|||
addEvent(clock_box, 'click', cancelEventPropagation);
|
||||
|
||||
quickElement('h2', clock_box, gettext('Choose a time'));
|
||||
var time_list = quickElement('ul', clock_box, '');
|
||||
var time_list = quickElement('ul', clock_box);
|
||||
time_list.className = 'timelist';
|
||||
quickElement("a", quickElement("li", time_list, ""), gettext("Now"), "href", "javascript:DateTimeShortcuts.handleClockQuicklink(" + num + ", -1);");
|
||||
quickElement("a", quickElement("li", time_list, ""), gettext("Midnight"), "href", "javascript:DateTimeShortcuts.handleClockQuicklink(" + num + ", 0);");
|
||||
quickElement("a", quickElement("li", time_list, ""), gettext("6 a.m."), "href", "javascript:DateTimeShortcuts.handleClockQuicklink(" + num + ", 6);");
|
||||
quickElement("a", quickElement("li", time_list, ""), gettext("Noon"), "href", "javascript:DateTimeShortcuts.handleClockQuicklink(" + num + ", 12);");
|
||||
quickElement("a", quickElement("li", time_list), gettext("Now"), "href", "javascript:DateTimeShortcuts.handleClockQuicklink(" + num + ", -1);");
|
||||
quickElement("a", quickElement("li", time_list), gettext("Midnight"), "href", "javascript:DateTimeShortcuts.handleClockQuicklink(" + num + ", 0);");
|
||||
quickElement("a", quickElement("li", time_list), gettext("6 a.m."), "href", "javascript:DateTimeShortcuts.handleClockQuicklink(" + num + ", 6);");
|
||||
quickElement("a", quickElement("li", time_list), gettext("Noon"), "href", "javascript:DateTimeShortcuts.handleClockQuicklink(" + num + ", 12);");
|
||||
|
||||
var cancel_p = quickElement('p', clock_box, '');
|
||||
var cancel_p = quickElement('p', clock_box);
|
||||
cancel_p.className = 'calendar-cancel';
|
||||
quickElement('a', cancel_p, gettext('Cancel'), 'href', 'javascript:DateTimeShortcuts.dismissClock(' + num + ');');
|
||||
django.jQuery(document).bind('keyup', function(event) {
|
||||
|
@ -249,7 +249,7 @@ var DateTimeShortcuts = {
|
|||
addEvent(cal_box, 'click', cancelEventPropagation);
|
||||
|
||||
// next-prev links
|
||||
var cal_nav = quickElement('div', cal_box, '');
|
||||
var cal_nav = quickElement('div', cal_box);
|
||||
var cal_nav_prev = quickElement('a', cal_nav, '<', 'href', 'javascript:DateTimeShortcuts.drawPrev('+num+');');
|
||||
cal_nav_prev.className = 'calendarnav-previous';
|
||||
var cal_nav_next = quickElement('a', cal_nav, '>', 'href', 'javascript:DateTimeShortcuts.drawNext('+num+');');
|
||||
|
@ -262,7 +262,7 @@ var DateTimeShortcuts = {
|
|||
DateTimeShortcuts.calendars[num].drawCurrent();
|
||||
|
||||
// calendar shortcuts
|
||||
var shortcuts = quickElement('div', cal_box, '');
|
||||
var shortcuts = quickElement('div', cal_box);
|
||||
shortcuts.className = 'calendar-shortcuts';
|
||||
quickElement('a', shortcuts, gettext('Yesterday'), 'href', 'javascript:DateTimeShortcuts.handleCalendarQuickLink(' + num + ', -1);');
|
||||
shortcuts.appendChild(document.createTextNode('\240|\240'));
|
||||
|
@ -271,7 +271,7 @@ var DateTimeShortcuts = {
|
|||
quickElement('a', shortcuts, gettext('Tomorrow'), 'href', 'javascript:DateTimeShortcuts.handleCalendarQuickLink(' + num + ', +1);');
|
||||
|
||||
// cancel bar
|
||||
var cancel_p = quickElement('p', cal_box, '');
|
||||
var cancel_p = quickElement('p', cal_box);
|
||||
cancel_p.className = 'calendar-cancel';
|
||||
quickElement('a', cancel_p, gettext('Cancel'), 'href', 'javascript:DateTimeShortcuts.dismissCalendar(' + num + ');');
|
||||
django.jQuery(document).bind('keyup', function(event) {
|
||||
|
|
|
@ -35,10 +35,10 @@ function cancelEventPropagation(e) {
|
|||
if (e.stopPropagation) e.stopPropagation();
|
||||
}
|
||||
|
||||
// quickElement(tagType, parentReference, textInChildNode, [, attribute, attributeValue ...]);
|
||||
// quickElement(tagType, parentReference [, textInChildNode, attribute, attributeValue ...]);
|
||||
function quickElement() {
|
||||
var obj = document.createElement(arguments[0]);
|
||||
if (arguments[2] != '' && arguments[2] != null) {
|
||||
if (arguments[2]) {
|
||||
var textNode = document.createTextNode(arguments[2]);
|
||||
obj.appendChild(textNode);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue