WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#37944 closed defect (bug) (invalid)

review of opening tags immediately followed by closing tags of same type

Reported by: Presskopp Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.7
Component: General Keywords:
Focuses: Cc:

Description

Poking the core files I found some of these:

<div></div> (10 hits in 7 files) and <span></span> (9 hits in 8 files)

We also find <ul></ul>, <li></li>, ...?

I wonder if these can be safely deleted.

Change History (6)

#1 @dd32
3 years ago

<div></div> & <span></span>

The ones I can find appear to be needed, based on their locations

<ul></ul>

Appears that this would get filled with <li>'s from an ajax request

<li></li>

I don't see any of those

All in all, these tags are usually like this within either HTML templates for JS actions, or are used for styling purposes (for example, nested :before's.
If you can find any in the UI which have no styling or JS interacting with them, then we can clean them up, but you'll need to list the specific instances of the tags which are unused.

#2 @Presskopp
3 years ago

Ah, ok, now it makes some sense to me.

There is a return '<li></li>'; in customize-controls.js , L.509.

Will see if i still find surplus ones.

same with <strong>, see
https://core.trac.wordpress.org/ticket/37280#comment:5

Last edited 3 years ago by Presskopp (previous) (diff)

#3 @dd32
3 years ago

There is a return '<li></li>'; in customize-controls.js , L.509.

Ah so there is, I had excluded JS from my greps.. That particular case gets content injected into the <li> elsewhere, as it's just the container for more content from other parts of the control.

#4 follow-up: @Presskopp
3 years ago

Ok, last chance to keep this ticket alive:

<label><span></span> in class-wp-editor.php, L.1436

Do we need this one?

All the others are indispensable placeholders, as I understand now, do I?

Last edited 3 years ago by Presskopp (previous) (diff)

#5 in reply to: ↑ 4 @dd32
3 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Replying to Presskopp:

Ok, last chance to keep this ticket alive:

<label><span></span> in class-wp-editor.php, L.1436

Do we need this one?

If you look at where it's output in the UI, you'll find that yes, it's needed. It's an empty placeholder to ensure menu alignments in the advanced link editing dialogue. If you remove it you'll see the layout break slightly.

I'm marking this ticket as invalid, but feel free to create additional tickets for any HTML tags which once removed you've verified don't alter the UI where it's used.

#6 @Presskopp
3 years ago

Surely will, even if chances that can happen are about zero, which is good :)
Thanks again @dd32 for opening my (our) eyes. Before making this ticket I asked "somebody" if he knew for what these tags are there, and he didn't know..

Note: See TracTickets for help on using tickets.