Make WordPress Core

Opened 4 weeks ago

Last modified 4 weeks ago

#64016 new enhancement

Unnecessary HTML comments in the comments walker.

Reported by: edent's profile edent Owned by:
Milestone: Awaiting Review Priority: normal
Severity: trivial Version: 6.8.2
Component: Comments Keywords:
Focuses: Cc:

Description

When wp_list_comments() uses the ul or ol style, the source-code of the page becomes littered with <!-- .children --> and <!-- #comment-## -->

These are caused by class-walker-comment.php#L91 and #L238

This was introduced in 2013 with the comment "Some helpful HTML comments to help untangle the HTML".

I'm not sure what utility these HTML comments add. They aren't targetted by any existing code that I can find. The HTML produced is fairly straightforward and doesn't need untangling.

I plan to send a PR to remove the HTML comments from the output - unless anyone has strong feelings otherwise?

Change History (2)

#1 follow-up: @edent
4 weeks ago

Similarly, there's an unnecessary <!-- #respond --> at comment-template.php#L2901

Possibly caused by https://github.com/WordPress/WordPress/commit/919f08fd2d15bc831a9f40daf0a52bc00f93bf64

Again, I propose removing it.

#2 in reply to: ↑ 1 @SergeyBiryukov
4 weeks ago

Hi there, thanks for the ticket!

Replying to edent:

Similarly, there's an unnecessary <!-- #respond --> at comment-template.php#L2901

Introduced in [14092] / #13016.

Personally, I don't see any harm in keeping these comments as is, they seem helpful to determine which element the closing tag corresponds to, especially with multiple </div> or </ul> tags on the page.

Last edited 4 weeks ago by SergeyBiryukov (previous) (diff)
Note: See TracTickets for help on using tickets.