Make WordPress Core

Opened 6 weeks ago

Last modified 6 weeks ago

#66024 new defect (bug)

Unused closing div tag in wp_print_media_templates method

Reported by: jdorner Owned by:
Priority: high Milestone: Awaiting Review
Component: Media Version: 7.1
Severity: normal Keywords: has-patch
Cc: Focuses:

Description

wp-includes/media-template.php line 1588

There is no opening tag associated with the closing </div>

Deleting the closing </div> fixes the problem.

Change History (3)

This ticket was mentioned in ​PR #13366 on ​WordPress/wordpress-develop by ​@iamchitti.


6 weeks ago
#1

  • Keywords has-patch added; needs-patch removed

## Description

Trac ticket: https://core.trac.wordpress.org/ticket/66024

The tmpl-site-icon-preview-crop Backbone template in media-template.php opens three div elements but closes four, leaving an unmatched </div>.

The markup was adapted from the Site Icon preview in options-general.php, which has an extra .direction-wrap wrapper. The wrapper wasn't carried over, but its closing tag was — along with the extra indentation on the .close-button SVG.

This removes the stray tag and dedents the SVG back to a direct child of .site-icon-preview-tab, as its grid-template-columns rule expects.

​@mukesh27 commented on ​PR #13366:


6 weeks ago
#2

Introduce in Core-60625 / r58927

#3 @khokansardar
6 weeks ago

The same stray </div> is in src/wp-admin/options-general.php at line 181. That block looks like the origin of this one — it carries the identical over-indented close-button SVG at lines 174-176.

Measured on the rendered page rather than the source: the Site Icon table cell emits 6 <div> and 7 </div>, and that cell accounts for the whole document's imbalance.

No user-visible effect in either location. Both blocks sit inside a container that bounds the HTML "has an element in scope" check — a <script type="text/html"> here, a <td> there — so the parser discards the unmatched closer rather than letting it close an ancestor.

Same fix shape as this patch: drop the last closer and dedent lines 174-180 one level. .site-icon-preview-tab is grid-template-columns: 24px auto 24px and renders exactly three children, so the surplus tag is a closer, not a missing wrapper.

Happy to open a separate ticket if you would rather keep this one scoped to wp_print_media_templates().

Note: See TracTickets for help on using tickets.