From 2161db0792f2e4d3deef3e09cd72f7a08340cafe Mon Sep 17 00:00:00 2001 From: Nick Pope Date: Thu, 29 Apr 2021 19:29:08 +0100 Subject: [PATCH] Fixed capitalization of "ECMAScript" and "JavaScript". --- django/contrib/admin/static/admin/js/core.js | 2 +- django/contrib/admin/templatetags/admin_list.py | 2 +- django/contrib/admin/templatetags/admin_modify.py | 2 +- django/http/response.py | 2 +- django/utils/jslex.py | 14 +++++++------- docs/ref/request-response.txt | 2 +- tests/admin_views/models.py | 2 +- tests/admin_widgets/tests.py | 2 +- tests/i18n/test_extraction.py | 2 +- tests/view_tests/tests/test_i18n.py | 4 ++-- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/django/contrib/admin/static/admin/js/core.js b/django/contrib/admin/static/admin/js/core.js index 3a2e4aa728..afdae281c3 100644 --- a/django/contrib/admin/static/admin/js/core.js +++ b/django/contrib/admin/static/admin/js/core.js @@ -1,4 +1,4 @@ -// Core javascript helper functions +// Core JavaScript helper functions 'use strict'; // quickElement(tagType, parentReference [, textInChildNode, attribute, attributeValue ...]); diff --git a/django/contrib/admin/templatetags/admin_list.py b/django/contrib/admin/templatetags/admin_list.py index f4b6d8d59f..86eade6fed 100644 --- a/django/contrib/admin/templatetags/admin_list.py +++ b/django/contrib/admin/templatetags/admin_list.py @@ -234,7 +234,7 @@ def items_for_result(cl, result, form): link_or_text = result_repr else: url = add_preserved_filters({'preserved_filters': cl.preserved_filters, 'opts': cl.opts}, url) - # Convert the pk to something that can be used in Javascript. + # Convert the pk to something that can be used in JavaScript. # Problem cases are non-ASCII strings. if cl.to_field: attr = str(cl.to_field) diff --git a/django/contrib/admin/templatetags/admin_modify.py b/django/contrib/admin/templatetags/admin_modify.py index ee5f23b8af..fcc1755199 100644 --- a/django/contrib/admin/templatetags/admin_modify.py +++ b/django/contrib/admin/templatetags/admin_modify.py @@ -10,7 +10,7 @@ register = template.Library() def prepopulated_fields_js(context): """ - Create a list of prepopulated_fields that should render Javascript for + Create a list of prepopulated_fields that should render JavaScript for the prepopulated fields for both the admin form and inlines. """ prepopulated_fields = [] diff --git a/django/http/response.py b/django/http/response.py index 1c22edaff3..f1f0a1ed43 100644 --- a/django/http/response.py +++ b/django/http/response.py @@ -581,7 +581,7 @@ class JsonResponse(HttpResponse): An HTTP response class that consumes data to be serialized to JSON. :param data: Data to be dumped into json. By default only ``dict`` objects - are allowed to be passed due to a security flaw before EcmaScript 5. See + are allowed to be passed due to a security flaw before ECMAScript 5. See the ``safe`` parameter for more information. :param encoder: Should be a json encoder class. Defaults to ``django.core.serializers.json.DjangoJSONEncoder``. diff --git a/django/utils/jslex.py b/django/utils/jslex.py index 1e3a8eb532..d775d23a35 100644 --- a/django/utils/jslex.py +++ b/django/utils/jslex.py @@ -1,4 +1,4 @@ -"""JsLex: a lexer for Javascript""" +"""JsLex: a lexer for JavaScript""" # Originally from https://bitbucket.org/ned/jslex import re @@ -75,23 +75,23 @@ class Lexer: class JsLexer(Lexer): """ - A Javascript lexer + A JavaScript lexer >>> lexer = JsLexer() >>> list(lexer.lex("a = 1")) [('id', 'a'), ('ws', ' '), ('punct', '='), ('ws', ' '), ('dnum', '1')] - This doesn't properly handle non-ASCII characters in the Javascript source. + This doesn't properly handle non-ASCII characters in the JavaScript source. """ # Because these tokens are matched as alternatives in a regex, longer # possibilities must appear in the list before shorter ones, for example, # '>>' before '>'. # - # Note that we don't have to detect malformed Javascript, only properly - # lex correct Javascript, so much of this is simplified. + # Note that we don't have to detect malformed JavaScript, only properly + # lex correct JavaScript, so much of this is simplified. - # Details of Javascript lexical structure are taken from + # Details of JavaScript lexical structure are taken from # http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf # A useful explanation of automatic semicolon insertion is at @@ -184,7 +184,7 @@ class JsLexer(Lexer): def prepare_js_for_gettext(js): """ - Convert the Javascript source `js` into something resembling C for + Convert the JavaScript source `js` into something resembling C for xgettext. What actually happens is that all the regex literals are replaced with diff --git a/docs/ref/request-response.txt b/docs/ref/request-response.txt index cc8006f5f7..ab1e6ce65d 100644 --- a/docs/ref/request-response.txt +++ b/docs/ref/request-response.txt @@ -1099,7 +1099,7 @@ Without passing ``safe=False``, a :exc:`TypeError` will be raised. it was possible to poison the JavaScript ``Array`` constructor. For this reason, Django does not allow passing non-dict objects to the :class:`~django.http.JsonResponse` constructor by default. However, most - modern browsers implement EcmaScript 5 which removes this attack vector. + modern browsers implement ECMAScript 5 which removes this attack vector. Therefore it is possible to disable this security precaution. Changing the default JSON encoder diff --git a/tests/admin_views/models.py b/tests/admin_views/models.py index 284a4cfacb..36a8423c41 100644 --- a/tests/admin_views/models.py +++ b/tests/admin_views/models.py @@ -759,7 +759,7 @@ class PrePopulatedPostLargeSlug(models.Model): """ Regression test for #15938: a large max_length for the slugfield must not be localized in prepopulated_fields_js.html or it might end up breaking - the javascript (ie, using THOUSAND_SEPARATOR ends up with maxLength=1,000) + the JavaScript (ie, using THOUSAND_SEPARATOR ends up with maxLength=1,000) """ title = models.CharField(max_length=100) published = models.BooleanField(default=False) diff --git a/tests/admin_widgets/tests.py b/tests/admin_widgets/tests.py index f701f1abff..1896279ec7 100644 --- a/tests/admin_widgets/tests.py +++ b/tests/admin_widgets/tests.py @@ -995,7 +995,7 @@ class DateTimePickerShortcutsSeleniumTests(AdminWidgetSeleniumTestCase): with self.wait_page_loaded(): self.selenium.find_element_by_name('_save').click() - # Make sure that "now" in javascript is within 10 seconds + # Make sure that "now" in JavaScript is within 10 seconds # from "now" on the server side. member = Member.objects.get(name='test') self.assertGreater(member.birthdate, now - error_margin) diff --git a/tests/i18n/test_extraction.py b/tests/i18n/test_extraction.py index ee8257175b..94d92ca93f 100644 --- a/tests/i18n/test_extraction.py +++ b/tests/i18n/test_extraction.py @@ -444,7 +444,7 @@ class BasicExtractorTests(ExtractorTests): self.assertIn('maƱana; charset=CHARSET', pot_contents) -class JavascriptExtractorTests(ExtractorTests): +class JavaScriptExtractorTests(ExtractorTests): PO_FILE = 'locale/%s/LC_MESSAGES/djangojs.po' % LOCALE diff --git a/tests/view_tests/tests/test_i18n.py b/tests/view_tests/tests/test_i18n.py index b4c27a296e..9276f61fea 100644 --- a/tests/view_tests/tests/test_i18n.py +++ b/tests/view_tests/tests/test_i18n.py @@ -324,7 +324,7 @@ class I18NViewTests(SimpleTestCase): def test_i18n_language_non_english_default(self): """ - Check if the Javascript i18n view returns an empty language catalog + Check if the JavaScript i18n view returns an empty language catalog if the default language is non-English, the selected language is English and there is not 'en' translation available. See #13388, #3594 and #13726 for more details. @@ -337,7 +337,7 @@ class I18NViewTests(SimpleTestCase): def test_non_english_default_english_userpref(self): """ Same as above with the difference that there IS an 'en' translation - available. The Javascript i18n view must return a NON empty language catalog + available. The JavaScript i18n view must return a NON empty language catalog with the proper English translations. See #13726 for more details. """ with self.settings(LANGUAGE_CODE='fr'), override('en-us'):