rviscomi / capo.js

Get your <head> in order
https://rviscomi.github.io/capo.js/
Apache License 2.0
929 stars 18 forks source link

Remove invalid elements from the sorted `head` #74

Open rviscomi opened 1 year ago

rviscomi commented 1 year ago

When logging the sorted head, omit any elements that have been previously flagged as invalid/discouraged.

rviscomi commented 6 months ago

This is complicated by the fact that some validation warnings are due to misconfigurations and are not necessarily encouraging their removal. If we ever do this, we should also attempt to fix the misconfigurations where possible.

For example:

<meta http-equiv="x-dns-prefetch-control" content="no">

The content="no" attribute value is non-standard.

Was this a typo of on, in which case DNS prefetching should be enabled? That's the default value, so this meta tag could be safely removed.

Was the intention actually to disable DNS prefetching? If so, the off value is standard, but Chrome will handle anything but on by disabling the feature. The value should be changed to off to be more explicit.

Then again, DNS prefetching is good for performance and legitimate security concerns are rare. So maybe it really ought to be removed.

The bottom line is that it's hard to know for sure what the developer's intent was and whether their concerns are legitimate, or they just copy/pasted some old markup without understanding what it does. In these cases, maybe it's best to do nothing and let the warnings guide the developer to making the right decision.