Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

pagespeed_no_defer and pagespeed_lsc_url break HTML5 validation #584

Open
GoogleCodeExporter opened this issue Apr 6, 2015 · 7 comments

Comments

@GoogleCodeExporter
Copy link

mod_pagespeed alters script and css tags to have the above tags, which break 
HTML5 validation (see 
http://validator.w3.org/check?uri=https://workbenchwarriors.com/&charset=%28dete
ct+automatically%29&doctype=HTML5&group=0 for an example).

These attributes would be better added as data-pagespeed-no-defer and 
data-pagespeed-lsc-url respectively, to pass HTML5 validation (see described 
here: http://html5doctor.com/html5-custom-data-attributes/) 



Original issue reported on code.google.com by bar...@shrikeh.net on 7 Dec 2012 at 11:57

@GoogleCodeExporter
Copy link
Author

To clarify, pagespeed-no-defer is something that mod_pagespeed allows you to 
specify on your tags, which mod_pagespeed then interprets.

mod_pagespeed should allow those to be specified in an HTML5-complaint way, 
such as the syntax you provide.

Additionally, the 'pedantic' filter could modify in-place markup specifying the 
non-html5-compliant syntax.

Original comment by jmara...@google.com on 7 Dec 2012 at 6:09

  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Author

Yep, that's what I was trying to say - badly. Thanks for clarifying. The tags 
in questions are added by the local_storage_cache filter in my example.

Original comment by bar...@shrikeh.net on 10 Dec 2012 at 5:21

@slayer1ss
Copy link

Hi, i am having same issue with prioritize_critical_css when i activate it pagespeed adds < script pagespeed_no_defer="">critical_css_loader script stuff</ script> to the bottom of my page and it breaks the validation, will there be a fix for this soon?

@jmaessen
Copy link
Contributor

No. Moving non-critical CSS to the bottom of the page is how prioritize_critical_css functions – there's no standards-compliant way we know of to lazy load the CSS without adding additional latency to your page. Given the choice, this filter has been forced to opt for a working solution rather than a strict standards-compliant one.

That said, we've change the non-standard pagespeed attributes to be spec-compliant; in the next release you should be able to use data-pagespeed-no-defer and pagespeed will indeed insert data-pagespeed-lsc-url. (This is currently available in head if you build from source.)

My suggestion: disable prioritize_critical_css and enable pedantic when you are running a validator. We suggest that you do the reverse in day-to-day operation.

@slayer1ss
Copy link

Just to be clear, i am perfectly happy with how prioritize_critical_css functions and wouldnt live without it... The problem is pagespeed-no-defer tag which is being add automaticly, so if i understand you correctly on next release that pagespeed-no-defer tag which was added by mps will automaticly change to data-pagespeed-no-defer and there wont be a problem anymore am i right?

Is this change included in latest beta release?

@crowell
Copy link
Contributor

crowell commented Sep 15, 2015

@slayer1ss the change here ab76063 as of now isn't included in the latest beta release.

@slayer1ss
Copy link

@crowell thank you very much for that information, it actually both answers my question about if i got it right and tells me that it is not ready yet :) I dont want to take any more of your time but do you guys have a timetable for this update?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants