WordPress.org

Making WordPress.org

Opened 5 years ago

Closed 4 years ago

#571 closed defect (invalid)

Discrepancy in CSS Coding Standards documentation

Reported by: McGuive7 Owned by:
Milestone: Priority: normal
Component: Handbooks Keywords: needs-patch
Cc:

Description

There is a slight discrepancy that may warrant correction in the section on CSS inline commenting: http://make.wordpress.org/core/handbook/coding-standards/css/#commenting

The text reads:
“Inline comments should not have empty newlines separating the comment from the item to which it relates.”

However the following code example is formatting WITH a newline break between the comment and the subsequent code block:

/* This is a comment about this selector */

.another-selector {
    position: absolute;
    top: 0 !important; /* I should explain why this is so !important */
}

Is this deliberate or not?

Change History (2)

#1 @Michael Arestad
4 years ago

The inline comment refers to this specific type of comment:

.selector {
  top: 0; /* I'm inline, yo */
}

However, I don't think there should be an empty newline between a comment about a selector and the selector itself though it doesn't mention it anywhere and could be open to interpretation. This is how I would do it.

Correct:

/* This is a comment about this selector */
.another-selector {
    position: absolute;
    top: 0 !important; /* I should explain why this is so !important */
}

Incorrect:

/* This is a comment about this selector */
 
.another-selector {
    position: absolute;
   /* I should explain why this is so !important */
    top: 0 !important;
}

I'm not sure any changes should be made to the docs at this time.

#2 @samuelsidler
4 years ago

  • Resolution set to invalid
  • Status changed from new to closed

Drew agrees.

Note: See TracTickets for help on using tickets.