WordPress.org

Make WordPress Core

Opened 2 years ago

Last modified 17 months ago

#43496 new defect (bug)

CS: Fix disabled for user-edit.php

Reported by: mukesh27 Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 4.1
Component: Users Keywords: has-patch
Focuses: coding-standards Cc:

Description

Many apologies if this is a duplicate. I have searched but did not find it yet posted.

According to W3C specifications and as per HTML Coding Standards( https://make.wordpress.org/core/handbook/best-practices/coding-standards/html/#quotes ) handbook all attributes must have a value, and must use double or single-quotes.

Attachments (2)

43496.patch (706 bytes) - added by mukesh27 2 years ago.
43496.2.patch (1.0 KB) - added by mukesh27 2 years ago.

Download all attachments as: .zip

Change History (15)

@mukesh27
2 years ago

#1 @mukesh27
2 years ago

  • Keywords has-patch added

#2 @netweb
2 years ago

  • Keywords commit added
  • Milestone changed from Awaiting Review to 5.0
  • Version set to 4.1

Thanks @mukesh27, spot on 👍

#3 follow-ups: @ocean90
2 years ago

  • Keywords commit removed

Since the admin doesn't use XHTML I'm not sure why we have to add a value to boolean attributes. The rule should probably be changed to exclude boolean attributes.

There are few other occurrences of disabled and also readonly without a value.

#4 in reply to: ↑ 3 @mukesh27
2 years ago

So needs to resolve all occurrences also if that coding part is not needed then we have to removed that.

Replying to ocean90:

Since the admin doesn't use XHTML I'm not sure why we have to add a value to boolean attributes. The rule should probably be changed to exclude boolean attributes.

There are few other occurrences of disabled and also readonly without a value.

Last edited 2 years ago by mukesh27 (previous) (diff)

@mukesh27
2 years ago

#5 in reply to: ↑ 3 ; follow-up: @netweb
2 years ago

Replying to ocean90:

Since the admin doesn't use XHTML I'm not sure why we have to add a value to boolean attributes. The rule should probably be changed to exclude boolean attributes.

Right, thanks, @ocean90 👍 , can you update the handbook to reflect this in the most appropriate way you think possible pelase 😃

#6 in reply to: ↑ 5 @GaryJ
2 years ago

Replying to netweb:

Replying to ocean90:

Since the admin doesn't use XHTML I'm not sure why we have to add a value to boolean attributes. The rule should probably be changed to exclude boolean attributes.

Right, thanks, @ocean90 👍 , can you update the handbook to reflect this in the most appropriate way you think possible pelase 😃

I'd like to think that would require a WPCS RFC or more discussion than just "should probably" :-)

#7 follow-up: @afercia
2 years ago

Worth reminding in core we can use HTML5 so all boolean attributes like disabled shouldn't use a value. Using just disabled is enough.

#8 in reply to: ↑ 7 @GaryJ
2 years ago

Replying to afercia:

Worth reminding in core we can use HTML5 so all boolean attributes like disabled shouldn't use a value. Using just disabled is enough.

Please see https://core.trac.wordpress.org/ticket/22249#comment:54.

#9 @pento
22 months ago

  • Milestone changed from 5.0 to 5.1

#10 follow-up: @pento
19 months ago

@GaryJ: Could you please clarify what your concern is here? The comment you linked to (and the w3c link) don't seem to apply to this.

#11 in reply to: ↑ 10 @GaryJ
19 months ago

Replying to pento:

@GaryJ: Could you please clarify what your concern is here? The comment you linked to (and the w3c link) don't seem to apply to this.

@pento

My comment was in response to the notion that "using HTML5" would directly discourage the use of boolean attributes with values. It doesn't. One can still be valid HTML5, and use boolean attributes with values.

Since the beginning, WordPress has tried to be valid HTML, but with seemingly a bit of leaning towards XHTML - think of the presence of self-closing / empty elements, like <br />, <hr /> and <img ... />. The requirement of having a space before the closing slash is even in the core coding standards - and yet under non-XHTML HTML5, <br>, <hr> and <img ...> would be perfectly valid.

Look at the mess of the source of https://wordpress.org to see how inconsistent the use of /> is in link and meta elements. Some of this will be from core, others from theme, but there's no community agreement formalising which it should be.

The presence of the xmlns="http://www.w3.org/1999/xhtml" in the html tag is another thing that is only needed for XHTML.

The checked(), selected(), disabled() and readonly() functions explicitly return the relevant attributes with values, which is only needed for XHTML.

I've raised this inconsistency before. I'm not expecting wp-admin to be able to be served as application/xhtml+xml out of the box, but overall, it would be good for WordPress to decide if it's going to support any XML-serialized HTML features, or whether it can drop officially />, the xmlns attribute`, boolean attributes with values, and other things like un-necessary quotes around certain attribute values, from its code and coding standards.

The case FOR keeping the above, is to hold ourselves to a slightly stricter, but not XHTML, form of markup output, one that includes boolean attributes with values.

Until that's decided, there will be an inevitable discussion about cases like this.

#12 @pento
19 months ago

  • Milestone changed from 5.1 to Future Release

XHTML. PHP. MySQL. Nothing good happens when you try to improve upon version 4 of anything.

Say, what version is WordPress up to?

Moving this ticket out of the milestone, as it requires further discussion and coding standards updates.

#13 @swissspidy
17 months ago

#46626 was marked as a duplicate.

Note: See TracTickets for help on using tickets.