diff --git a/django/contrib/admin/static/admin/js/collapse.js b/django/contrib/admin/static/admin/js/collapse.js deleted file mode 100644 index c6c7b0f68a..0000000000 --- a/django/contrib/admin/static/admin/js/collapse.js +++ /dev/null @@ -1,43 +0,0 @@ -/*global gettext*/ -'use strict'; -{ - window.addEventListener('load', function() { - // Add anchor tag for Show/Hide link - const fieldsets = document.querySelectorAll('fieldset.collapse'); - for (const [i, elem] of fieldsets.entries()) { - // Don't hide if fields in this fieldset have errors - if (elem.querySelectorAll('div.errors, ul.errorlist').length === 0) { - elem.classList.add('collapsed'); - const h2 = elem.querySelector('h2'); - const link = document.createElement('a'); - link.id = 'fieldsetcollapser' + i; - link.className = 'collapse-toggle'; - link.href = '#'; - link.textContent = gettext('Show'); - h2.appendChild(document.createTextNode(' (')); - h2.appendChild(link); - h2.appendChild(document.createTextNode(')')); - } - } - // Add toggle to hide/show anchor tag - const toggleFunc = function(ev) { - if (ev.target.matches('.collapse-toggle')) { - ev.preventDefault(); - ev.stopPropagation(); - const fieldset = ev.target.closest('fieldset'); - if (fieldset.classList.contains('collapsed')) { - // Show - ev.target.textContent = gettext('Hide'); - fieldset.classList.remove('collapsed'); - } else { - // Hide - ev.target.textContent = gettext('Show'); - fieldset.classList.add('collapsed'); - } - } - }; - document.querySelectorAll('fieldset.module').forEach(function(el) { - el.addEventListener('click', toggleFunc); - }); - }); -} diff --git a/docs/releases/5.1.txt b/docs/releases/5.1.txt index e4f0b37402..faaa5c9833 100644 --- a/docs/releases/5.1.txt +++ b/docs/releases/5.1.txt @@ -425,6 +425,9 @@ Miscellaneous when the fieldset has a name and use the ``collapse`` class, now includes ``
`` and ```` elements. +* The JavaScript file ``collapse.js`` is removed since it is no longer needed + in the Django admin site. + * :meth:`.SimpleTestCase.assertURLEqual` and :meth:`~django.test.SimpleTestCase.assertInHTML` now add ``": "`` to the ``msg_prefix``. This is consistent with the behavior of other assertions. diff --git a/js_tests/tests.html b/js_tests/tests.html index adeac66125..011998e5a7 100644 --- a/js_tests/tests.html +++ b/js_tests/tests.html @@ -143,7 +143,6 @@ -