Opened 7 years ago
Last modified 6 years 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)
Change History (15)
#2
@
7 years ago
- Keywords commit added
- Milestone changed from Awaiting Review to 5.0
- Version set to 4.1
#3
follow-ups:
↓ 4
↓ 5
@
7 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
@
7 years ago
So needs to resolve all occurrences
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 alsoreadonly
without a value.
#5
in reply to:
↑ 3
;
follow-up:
↓ 6
@
7 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
@
7 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:
↓ 8
@
7 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
@
7 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 justdisabled
is enough.
Please see https://core.trac.wordpress.org/ticket/22249#comment:54.
#10
follow-up:
↓ 11
@
6 years 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
@
6 years 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.
Thanks @mukesh27, spot on 👍