mirror of https://github.com/django/django.git
Fixed #31013 -- Removed jQuery usage in SelectBox.js.
This commit is contained in:
parent
0290e01d5a
commit
ef93fd4683
|
@ -1,4 +1,4 @@
|
||||||
(function($) {
|
(function() {
|
||||||
'use strict';
|
'use strict';
|
||||||
var SelectBox = {
|
var SelectBox = {
|
||||||
cache: {},
|
cache: {},
|
||||||
|
@ -18,8 +18,7 @@
|
||||||
// Repopulate HTML select box from cache
|
// Repopulate HTML select box from cache
|
||||||
var box = document.getElementById(id);
|
var box = document.getElementById(id);
|
||||||
var node;
|
var node;
|
||||||
$(box).empty(); // clear all options
|
box.innerHTML = '';
|
||||||
var new_options = box.outerHTML.slice(0, -9); // grab just the opening tag
|
|
||||||
var cache = SelectBox.cache[id];
|
var cache = SelectBox.cache[id];
|
||||||
for (var i = 0, j = cache.length; i < j; i++) {
|
for (var i = 0, j = cache.length; i < j; i++) {
|
||||||
node = cache[i];
|
node = cache[i];
|
||||||
|
@ -27,11 +26,9 @@
|
||||||
var new_option = new Option(node.text, node.value, false, false);
|
var new_option = new Option(node.text, node.value, false, false);
|
||||||
// Shows a tooltip when hovering over the option
|
// Shows a tooltip when hovering over the option
|
||||||
new_option.setAttribute("title", node.text);
|
new_option.setAttribute("title", node.text);
|
||||||
new_options += new_option.outerHTML;
|
box.appendChild(new_option);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
new_options += '</select>';
|
|
||||||
box.outerHTML = new_options;
|
|
||||||
},
|
},
|
||||||
filter: function(id, text) {
|
filter: function(id, text) {
|
||||||
// Redisplay the HTML select box, displaying only the choices containing ALL
|
// Redisplay the HTML select box, displaying only the choices containing ALL
|
||||||
|
@ -141,4 +138,4 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
window.SelectBox = SelectBox;
|
window.SelectBox = SelectBox;
|
||||||
})(django.jQuery);
|
})();
|
||||||
|
|
Loading…
Reference in New Issue