Make WordPress Core

Opened 13 months ago

Last modified 13 months ago

#64016 new enhancement

Unnecessary HTML comments in the comments walker.

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

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
13 months 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
13 months 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 keep 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.

Version 0, edited 13 months ago by SergeyBiryukov (next)
Note: See TracTickets for help on using tickets.