mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Fixed #36537 -- Ensured unique HTML IDs for geometry widget option scripts in the admin.
This work amends the code from f2f6046c0f
where multiple geometry widgets rendered `<script>` elements in the
admin with the same HTML `id`, resulting in invalid HTML and fragile
JavaScript selectors. Refs #25706.
This change uses the widget's textarea ID to generate a unique `id` for
each JSON options `<script>`, ensuring valid and robust markup.
Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
This commit is contained in:
committed by
nessita
parent
2013092b69
commit
0a262c8407
@@ -142,7 +142,7 @@ QUnit.test('initMapWidgetInSection initializes widgets and skips __prefix__', fu
|
||||
wrapper1.innerHTML = `
|
||||
<textarea id="id_point"></textarea>
|
||||
<div class="dj_map" id="id_point_map"></div>
|
||||
<script type="application/json" id="mapwidget-options">
|
||||
<script type="application/json" id="id_point_mapwidget_options">
|
||||
{ "geom_name": "Point" }
|
||||
</script>
|
||||
`;
|
||||
@@ -154,7 +154,7 @@ QUnit.test('initMapWidgetInSection initializes widgets and skips __prefix__', fu
|
||||
wrapper2.innerHTML = `
|
||||
<textarea id="id_fake"></textarea>
|
||||
<div class="dj_map" id="id_fake_map"></div>
|
||||
<script type="application/json" id="mapwidget-options">
|
||||
<script type="application/json" id="id_fake_mapwidget_options">
|
||||
{ "geom_name": "MultiPoint" }
|
||||
</script>
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user