WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 4 years ago

#31321 closed defect (bug) (wontfix)

TinyMCE Fails HTML Validation

Reported by: kraftbj Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Editor Keywords: close
Focuses: Cc:

Description

While running the Press This feature category through HTML validation, two TinyMCE-related errors appeared:

  1. Element link is missing required attribute property originating from <link rel='stylesheet' id='editor-buttons-css' href='http://kraftbj.wpsandbox.me/wp-includes/css/editor.min.css?ver=4.2-alpha-31438' type='text/css' media='all' /> which is being inserted from https://core.trac.wordpress.org/browser/tags/4.1/src/wp-includes/class.wp-styles.php#L91
  1. Attribute autocomplete not allowed on element textarea at this point originating from : https://core.trac.wordpress.org/browser/tags/4.1/src/wp-includes/class-wp-editor.php#L235

For 1, basically, link elements, namely with the rel attribute, must be in the docment's head. All modern browsers support them everywhere. Likely a wontfix IMO.

2: I'm not sure why this is being triggered.

Didn't see an existing ticket, so wanted a point of reference, even if they're both acceptable and wontfix.

Change History (3)

#1 @azaozz
5 years ago

  • Keywords close added

For 1: yes, generally it should be <style scoped> @import... </style> to pass validation. However as you mention all browsers support <link> mid-page and none fully supports scoped yet, so "wontfix" sounds right.

For 2: not sure where this is coming from either. Could it be a false positive? There is also autocomplete="off" on the form element in Chrome (as it disregards individual fields autocomplete attributes) but that is not invalid. The textarea either has its own attribute or inherits from the form element: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#attr-autocomplete.

#2 @afercia
5 years ago

About 1:

4.2.4 The link element
in HTML 5
http://www.w3.org/TR/html/document-metadata.html#the-link-element
A link element must have a rel attribute.
Note: If the rel attribute is used, the element is restricted to the head element.

in HTML 5.1
4.2.4 The link element
http://www.w3.org/html/wg/drafts/html/master/document-metadata.html#the-link-element
A link element must have either a rel attribute or an itemprop attribute, but not both.
Note: If the rel attribute is used, the element is restricted to the head element. When used with the itemprop attribute, the element can be used both in the head element and in the body of the page, subject to the constraints of the microdata model.

In this case seems the validator validates against HTML 5.1, tried adding:
itemprop="url" to the link element and itemscope to its container and it validates.

Not sure if the itemprop value should be "the absolute URL that results from resolving the value of the element's href" https://html.spec.whatwg.org/multipage/microdata.html#values

That said, I wouldn't do any of this :)

#3 @iseulde
4 years ago

  • Component changed from TinyMCE to Editor
  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed
  • Version 4.2 deleted

See above comments.

Note: See TracTickets for help on using tickets.