Make WordPress Core

Opened 3 months ago

Closed 3 months ago

Last modified 7 weeks ago

#63289 closed defect (bug) (wontfix)

Error in validator.w3 (After updating to version 6.8)

Reported by: mike77777's profile mike77777 Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: General Keywords:
Focuses: Cc:

Description (last modified by sabernhardt)

After updating the site to version 6.8, in the validator – validator.w3.org, an error appeared – ‘ Error: Bad value speculationrules for attribute type on element script: Subtype missing.From line 778, column 1; to line 778, column 32v>↩</div>↩<script type="speculationrules">↩{"pre

How can I fix it? I have no errors on my site except this one and it’s very frustrating.

During the previous update I also had an error in the validator related to – contain-intrinsic-size, I had to solve it myself by adding to the file – functions.php, the line add_filter('wp_img_tag_add_auto_sizes', '__return_false'); more about this – https://core.trac.wordpress.org/ticket/62413.

Change History (8)

#2 @robin_dean
3 months ago

I'm faced with the same bug. This is invalid HTML, as was the "contain-intrinsic-size" issue. Please, stop adding invalid html to the core or even better, check that the end result is valid html (in my case html5).

#3 follow-up: @peterwilsoncc
3 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

As documented on MDN, speculationrules is a valid value for the type attribute for the Speculation Rules API. You can read more about WordPress's use of speculative loading in the dev-note.

While the W3C's validator is a helpful tool, it can be a little behind browser implementations as features gain support during the late stages of the standardization process. WordPress focuses on what will be useful for users and will often implement such features as they arrive in browsers. This is one such case.

If you wish to remove the speculative loading API from your site, you can use the wp_speculation_rules_configuration hook to do so.

add_filter( 'wp_speculation_rules_configuration', '__return_null' );

I'm going to close this ticket off as wontfix, as I expect the validator will recognise the speculation rules API in a future update.

Last edited 3 months ago by peterwilsoncc (previous) (diff)

#4 @robin_dean
3 months ago

Then, maybe default to disabled. Let us decide.

Now I get to edit each of my client's functions.php, one at a time, insert this solution.

Last edited 3 months ago by robin_dean (previous) (diff)

#5 @samiamnot
3 months ago

@robin_dean, just out of curiosity, why would you bother changing things to score better on a validator that is out of date? Had the speculation rules bothered you on its own (it was added to improve performance), I would understand you making changes to slow things down (you may worry about the possible server hit from preloading), but why do it just for a validation that is simply out of date? This is sheer curiosity, and not a knock of any sort.

#6 @robin_dean
3 months ago

I'm not going to answer your question as it doesn't interest me.

Tell me what validator I'm using. I'm not here because the thread starter mentions validator.w3. I'm here because it's invalid html.

So please, by all means, tell me which validator you believe to be the current standard, the one which doesn't throw a validation error regarding the topic at hand.

Last edited 3 months ago by robin_dean (previous) (diff)

#7 @sabernhardt
3 months ago

The W3C validator is probably the best, but it's not perfect.

I highly recommend reporting the speculationrules error to them so they know to update it:
https://validator.w3.org/contribute.html

#8 in reply to: ↑ 3 @karl53
7 weeks ago

"As documented on MDN, speculationrules is a valid value for the type attribute for the Speculation Rules API."

The error I get isn't that the 'speculationrules' itself isn't valid. This is what I get:

"Bad value “speculationrules” for attribute “type” on element “script”: Subtype missing."

So the problem is a missing subtype.

I just wanted to share this with you. The W3.org local Java-based tool can't parse the URL on Windows, but it can on Mac.

Replying to peterwilsoncc:

As documented on MDN, speculationrules is a valid value for the type attribute for the Speculation Rules API. You can read more about WordPress's use of speculative loading in the dev-note.

While the W3C's validator is a helpful tool, it can be a little behind browser implementations as features gain support during the late stages of the standardization process. WordPress focuses on what will be useful for users and will often implement such features as they arrive in browsers. This is one such case.

If you wish to remove the speculative loading API from your site, you can use the wp_speculation_rules_configuration hook to do so.

add_filter( 'wp_speculation_rules_configuration', '__return_null' );

I'm going to close this ticket off as wontfix, as I expect the validator will recognise the speculation rules API in a future update.

Note: See TracTickets for help on using tickets.